working, but need to write test

This commit is contained in:
schmidtsi76327 committed 2021-06-25 18:35:16 +02:00
1 parent 55ebd21975
commit d059c3d72d
5 files changed
+142 -79

No files matched your search

+11 -8
View File
@@ -18,7 +18,7 @@ extern "C" {
#define NODEMCU_LED 16
// PWM
#include "pwm.h"
#include "treppe.h"
os_timer_t timer1;
uint8_t timer_flag = 0;
Treppe stairs(16);
@@ -102,25 +102,28 @@ void setup() {
Serial.println("PCA9685 connected !");
os_timer_setfn(&timer1, timerCallback, &timer_flag);
os_timer_arm(&timer1, 200, true);
os_timer_arm(&timer1, 20, true);
stairs.setState(1);
stairs.setDirection(1);
}
#include <random>
void loop() {
if(stairs.getState() == 0) {
delay(1000);
stairs.setState(1);
// uint32_t t = rand() % stairs.getTicks();
// uint32_t d = rand() % 2;
// stairs.setTick(t);
// stairs.setDirection(d);
stairs.setDirection(!stairs.getDirection());
stairs.setState(1);
}
// 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");
}