Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht
This commit is contained in:
commit
09aff91b31
33
src/main.cpp
33
src/main.cpp
@ -14,16 +14,24 @@ os_timer_t Timer1; // Verwaltungsstruktur des Timers
|
|||||||
int c;
|
int c;
|
||||||
bool toggle = false;
|
bool toggle = false;
|
||||||
uint32_t m=0;
|
uint32_t m=0;
|
||||||
|
|
||||||
|
uint32_t dimmtimer = 0;
|
||||||
|
uint8_t direction = 1;
|
||||||
|
uint8_t onoff = 1;
|
||||||
|
|
||||||
|
|
||||||
|
void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor);
|
||||||
|
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval, uint8_t factor);
|
||||||
|
|
||||||
void timerCallback(void *pArg)
|
void timerCallback(void *pArg)
|
||||||
{
|
{
|
||||||
*((int *) pArg) += 1;
|
*((int *) pArg) += 1;
|
||||||
toggle = !toggle;
|
|
||||||
digitalWrite(NODEMCU_LED, toggle);
|
ledsequence(direction, onoff, 4);
|
||||||
|
// Serial.print("[");
|
||||||
Serial.print("[");
|
// Serial.print(micros()-m);
|
||||||
Serial.print(micros()-m);
|
// Serial.print("] timerCallback\n");
|
||||||
Serial.print("] timerCallback\n");
|
// m = micros();
|
||||||
m = micros();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OTA & WEB
|
// OTA & WEB
|
||||||
@ -187,9 +195,10 @@ void setup() {
|
|||||||
delay(5000);
|
delay(5000);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
os_timer_setfn(&Timer1, timerCallback, &c);
|
os_timer_setfn(&Timer1, timerCallback, &c);
|
||||||
os_timer_arm(&Timer1, 1000, true);
|
os_timer_arm(&Timer1, 1, true);
|
||||||
|
|
||||||
|
|
||||||
Serial.println("Ready");
|
Serial.println("Ready");
|
||||||
Serial.print("IP address: ");
|
Serial.print("IP address: ");
|
||||||
@ -289,12 +298,10 @@ void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor){
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
static uint32_t dimmtimer = 0;
|
|
||||||
static uint8_t direction = 1;
|
|
||||||
static uint8_t onoff = 1;
|
|
||||||
|
|
||||||
if(millis() - dimmtimer > 2){
|
if(millis() - dimmtimer > 2){
|
||||||
ledsequence(direction, onoff, 4);
|
//ledsequence(direction, onoff, 4);
|
||||||
dimmtimer = millis();
|
dimmtimer = millis();
|
||||||
}
|
}
|
||||||
if(millis() > 25000 && onoff == 1 && direction == 1) onoff = 0;
|
if(millis() > 25000 && onoff == 1 && direction == 1) onoff = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user