After building up another sketch from scratch, I found the source of the problem from the last post. Those sketches stored milliseconds in an int, and that just isn’t big enough.
So this:
// state for the led1 function static int led1Millis; static int led1State = LOW; // state for the led2 function static int led2Millis; static int led2State = LOW;
Becomes this:
// state for the led1 function static long led1Millis; static int led1State = LOW; // state for the led2 function static long led2Millis; static int led2State = LOW;
Now both versions work flawlessly. Now to make it do something interesting…
This blog post just saved me! Thanks! :P