@jiggy-ninja:
I also prefer the switch statement but you need break statements in there to make it equivalent to the original code. I would write it like this:
void updateLed_A_State()
{
switch( led_A_State )
{
case LOW:
if (currentMillis - previousLed_A_Millis >= led_A_Interval)
{
led_A_State = HIGH;
previousLed_A_Millis = currentMillis;
}
break;
case HIGH:
if (currentMillis - previousLed_A_Millis >= blinkDuration)
{
led_A_State = LOW;
previousLed_A_Millis = currentMillis;
}
break;
default:
break;
}
}
Pete