added software timer
This commit is contained in:
parent
61d6cde899
commit
49f9c9c217
28
src/main.cpp
28
src/main.cpp
@ -3,6 +3,24 @@
|
|||||||
|
|
||||||
#include "PCA9685.h"
|
#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
|
// Änderung
|
||||||
// OTA & WEB
|
// OTA & WEB
|
||||||
#include "wifi_credentials.h"
|
#include "wifi_credentials.h"
|
||||||
@ -149,8 +167,6 @@ void setup_pwm_pca9685() {
|
|||||||
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
|
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println(F("Booting ...."));
|
Serial.println(F("Booting ...."));
|
||||||
@ -167,6 +183,9 @@ void setup() {
|
|||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_timer_setfn(&Timer1, timerCallback, &c);
|
||||||
|
os_timer_arm(&Timer1, 1000, true);
|
||||||
|
|
||||||
Serial.println("Ready");
|
Serial.println("Ready");
|
||||||
Serial.print("IP address: ");
|
Serial.print("IP address: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
@ -278,11 +297,6 @@ void loop() {
|
|||||||
onoff = 1;
|
onoff = 1;
|
||||||
direction = 0;
|
direction = 0;
|
||||||
}
|
}
|
||||||
TIMEIF_US("OTA", ArduinoOTA.handle(), 20000);
|
|
||||||
TIMEIF_US("HTTP", server.handleClient(), 20000);
|
|
||||||
|
|
||||||
TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
|
TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
|
||||||
|
|
||||||
TIMEIF_US("HTTP", server.handleClient(), 1000);
|
TIMEIF_US("HTTP", server.handleClient(), 1000);
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user