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 952B

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. PCA9685 pwmController;
  13. uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval);
  14. void ledsequence();
  15. public:
  16. Treppe(uint8_t _stairs) : stairs(_stairs){}
  17. void task(); // call periodically
  18. void setup();
  19. // Parameter section
  20. uint16_t setIdle(uint16_t _idle_brightness);
  21. uint16_t setActive(uint16_t _active_brightness);
  22. uint16_t setTime(uint16_t _time_per_stair);
  23. // Runtime Parameter section
  24. uint8_t setDirection(uint8_t _direction);
  25. uint8_t setState(uint8_t _state);
  26. uint8_t getState() { return state;};
  27. uint8_t getDirection() {return direction;};
  28. };