Closed WhiteLionATX closed 3 years ago
Can you try COROUTINE_DELAY(1000)
? The COROUTINE_DELAY_SECONDS(1)
loses accuracy for small values because it uses an approximation for / 1000
to save CPU time on some processors.
Can you try
COROUTINE_DELAY(1000)
? TheCOROUTINE_DELAY_SECONDS(1)
loses accuracy for small values because it uses an approximation for/ 1000
to save CPU time on some processors.
I tried COROUTINE_DELAY(1000)
, COROUTINE_DELAY_SECONDS(1)
, COROUTINE_DELAY_MICROS(1000000)
with different values ...aso. It seems that there is delay happening at all by all this. I cant debug to investigate on the microcontroller (ESP8266) I use.
What is the value of ledEffect_stars
? If that is not exactly 1, this becomes an infinite loop that cannot be broken. You need to add COROUTINE_YIELD()
after you break out of the for-loop. I don't know what the rest of your program does.
Can you put some print statements, and make sure the the loop is working?
COROUTINE(ledLoop)
{
static uint16_t i3b;
COROUTINE_LOOP()
{
for(i3b=STARS_START_LED; i3b<NUM_LEDS_TOTAL; i3b++)
{
if (ledEffect_stars != 1) break;
Serial.print(i3b);
Serial.println(": looping...");
COROUTINE_DELAY(1000);
}
COROUTINE_YIELD();
}
}
I noticed it was my fault. I am very sorry. It was a implicit type conversion problem of a part of my code above. I think you can move this to closed. Thank you very much for your fast & friendly replies!!
You still need that COROUTINE_YIELD()
to avoid an infinite loop when you break out of the for-loop. Good luck with your project.
I use it like this:
All code is working fine but there is no delay happening. (using different ESPs with PlatformIO)