diff --git a/src/main.cpp b/src/main.cpp index 97b729b..0e8bc5b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,24 @@ #include "PCA9685.h" +extern "C" { +#include "user_interface.h" +} +os_timer_t Timer1; // Verwaltungsstruktur des Timers + +uint32_t c; + +uint32_t m=0; +void timerCallback(void *pArg) +{ + *((int *) pArg) += 1; + + Serial.print("hallo\n"); + Serial.println(micros()-m); + m = micros(); +} + + // Ă„nderung // OTA & WEB #include "wifi_credentials.h" @@ -149,8 +167,6 @@ void setup_pwm_pca9685() { Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4 } - - void setup() { Serial.begin(115200); Serial.println(F("Booting ....")); @@ -167,6 +183,9 @@ void setup() { ESP.restart(); } + os_timer_setfn(&Timer1, timerCallback, &c); + os_timer_arm(&Timer1, 1000, true); + Serial.println("Ready"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); @@ -278,11 +297,6 @@ void loop() { onoff = 1; direction = 0; } - TIMEIF_US("OTA", ArduinoOTA.handle(), 20000); - TIMEIF_US("HTTP", server.handleClient(), 20000); - TIMEIF_US("OTA", ArduinoOTA.handle(), 1000); - TIMEIF_US("HTTP", server.handleClient(), 1000); - } \ No newline at end of file