ESP8266 Treppenlichtsteuerung mit OTA zum Firmware Upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pwm.h 1011B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "PCA9685.h"
  3. class Treppe {
  4. private:
  5. uint8_t stairs;
  6. uint16_t time_per_stair = 300; // dimmtime per stair [ms]
  7. uint16_t idle_brightness = 200;
  8. uint16_t active_brightness = 2048;
  9. uint8_t direction = 0;
  10. uint8_t state = 0;
  11. uint8_t switch_state = 0;
  12. // initialize with i2c-Address 0, use Wire Library
  13. PCA9685 pwmController;
  14. uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval);
  15. void ledsequence();
  16. public:
  17. Treppe(uint8_t _stairs) : stairs(_stairs){}
  18. void task(); // call periodically
  19. void setup();
  20. // Parameter section
  21. uint16_t setIdle(uint16_t _idle_brightness);
  22. uint16_t setActive(uint16_t _active_brightness);
  23. uint16_t setTime(uint16_t _time_per_stair);
  24. // Runtime Parameter section
  25. uint8_t setDirection(uint8_t _direction);
  26. uint8_t setState(uint8_t _state);
  27. uint8_t getState() { return state;};
  28. uint8_t getDirection() {return direction;};
  29. };