hello am trying to avoid using delay() function
am trying to use this code to avoid it but plz i would appreciate some one to help me out with it .
so if i wanna blink three LEDS in this example how i can do it ?where should i place the digitalwrite
for example instead of doing
digitalwrite(led,high)
delay(1000)
digitalwrite(led,low)
delay(1000)
digtalwrite(led2,high)
delay(1000)
digitalwrhite(led2,low)
delay(1000)
.how i can use this code and blink two or three leds with out delay function?
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
SparkCorePolledTimer updateTimer(1000); //Create a timer object and set it's timeout in milliseconds
void OnTimer(void); //Prototype for timer callback method
void setup() {
Serial1.begin(115200);
updateTimer.SetCallback(OnTimer);
}
void loop() {
updateTimer.Update();
}
void OnTimer(void) { //Handler for the timer, will be called automatically
Serial1.println("Hello");
}
so its not good to use delay in the loop void.
what about in the void steup is it ok to use it still it will stop the code then run or just in the void loop?
i did a lot of search i got some ideas but still i would be appreciate for help thanks .