This commit is contained in:
schmidtsi76327 committed 2021-06-25 04:53:06 +02:00
1 parent 2b2a135bd5
commit 55ebd21975
4 files changed
+92 -16

No files matched your search

+14 -7
View File
@@ -21,7 +21,7 @@ extern "C" {
#include "pwm.h"
os_timer_t timer1;
uint8_t timer_flag = 0;
Treppe stairs(13);
Treppe stairs(16);
// WIFI
const char* ssid = STASSID;
@@ -102,18 +102,25 @@ void setup() {
Serial.println("PCA9685 connected !");
os_timer_setfn(&timer1, timerCallback, &timer_flag);
os_timer_arm(&timer1, 20, true);
os_timer_arm(&timer1, 200, true);
stairs.setState(1);
stairs.setDirection(1);
}
void loop() {
if(millis() > 25000 && stairs.getState() == 1 && stairs.getDirection() == 1) stairs.setState(0);
if(millis() > 45000 && stairs.getDirection() == 1){
if(stairs.getState() == 0) {
delay(1000);
stairs.setState(1);
stairs.setDirection(0);
stairs.setDirection(!stairs.getDirection());
}
TIMEIF_US(ArduinoOTA.handle(), 1000, "OTA");
TIMEIF_US(httpServer.handleClient(), 1000, "HTTP");
// if(millis() > 25000 && stairs.getState() == 1 && stairs.getDirection() == 1) stairs.setState(0);
// if(millis() > 35000 && stairs.getDirection() == 1){
// stairs.setState(1);
// stairs.setDirection(0);
// }
TIMEIF_US(ArduinoOTA.handle(), 10000, "OTA");
TIMEIF_US(httpServer.handleClient(), 10000, "HTTP");
}