43 lines
1.1 KiB
C++

#pragma once
#include "PCA9685.h"
#define SENSOR1 15
#define SENSOR2 12
class Treppe {
private:
uint8_t stairs;
uint16_t time_per_stair = 300; // dimmtime per stair [ms]
uint16_t idle_brightness = 200;
uint16_t active_brightness = 2048;
uint8_t direction = 0;
uint8_t switch_direction = 0;
uint8_t state = 0;
uint8_t switch_state = 0;
uint8_t finish = 1;
// initialize with i2c-Address 0, use Wire Library
PCA9685 pwmController;
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval);
void ledsequence();
public:
Treppe(uint8_t _stairs) : stairs(_stairs){}
void task(); // call periodically
void setup();
// Parameter section
uint16_t setIdle(uint16_t _idle_brightness);
uint16_t setActive(uint16_t _active_brightness);
uint16_t setTime(uint16_t _time_per_stair);
// Runtime Parameter section
uint8_t setDirection(uint8_t _direction);
uint8_t setState(uint8_t _state);
uint8_t getState() { return state;};
uint8_t getDirection() {return direction;};
};