General area when it fits no where else

Moderator: Mmiscool

User avatar
By ardhuru
#48775 Guys, I have a code thats running satisfactorily. It does not use the timer.

Now, how would I blink an led in the background with an asymmetric duty cycle (on for 100ms every second) using the timer? I have seen examples where the led toggles symmetrically using the timer function, but I cant figure out how to modify that for asymmetric operation.

Another somewhat related query; the ESP8266 has 6 separate timers, right? Can ESP8266Basic use the others as well?

Regards.
User avatar
By russm
#48817 When the timer triggers (branches), turn on the LED, add a delay 100, turn off the LED, that completes the operation.

I think delay 100 would be 100ms...

Code: Select alltimer 1000, [blipLED]
wait

[blipLED]
io(po,16,1)
delay 100
io(po,16,0)
wait
end
User avatar
By ardhuru
#48864 Thank you very much, that worked like a charm.

I have another question though; is there a way to avoid the delay in the branched sub? I might loose some data I receive on the UDP channel during that delay?

Can any of the other timers be used for this?
User avatar
By russm
#48885 I'm sure someone will correct me if I'm wrong but receiving data (unless using the software serial port) is via hardware and it will be serviced without data loss, even while the delay is running.