Hey All,
I'm trying to get some code to work on an led so that it will blink twice, then delay. The code that I have gotten to work with using delay() is as follows.
digitalWrite(FastStrobe, HIGH);
delay(150);
digitalWrite(FastStrobe, LOW);
delay(200);
digitalWrite(FastStrobe, HIGH);
delay(150);
digitalWrite(FastStrobe, LOW);
delay(500);
However, that is of course throwing the rest of my code into weirdness because of the delay.
I have found other code online that suggest how to do it at a regular interval and it works great if I want to do simple on and off behavior.
void loop {
......
unsigned long SScurrenttime = millis(); // Assign a variable by the system time
if (SScurrenttime - prem_SlowStrobe >= timer_SlowStrobe) {
toggleSlowStrobes();
prem_SlowStrobe = SScurrenttime;
}
void toggleSlowStrobes() {
ledS_SlowStrobe = (ledS_SlowStrobe == HIGH) ? LOW : HIGH;
digitalWrite(SlowStrobe, ledS_SlowStrobe);
}
Any advise would be appreciated on how to do this without using delay.