I've got a weird issue while using the FastLED library.

I’ve got a weird issue while using the FastLED library. I have an Uno board, a 10 led strip, a 10k potentiometer, and a tactile button. As the code below shows, I have a timer that changes the mode every 10 seconds. That works, however the timing is off. It is about 5-6 seconds when serial communication is off and about 8 when serial are on. What could be causing this?

Here is my sketch: http://pastebin.com/UtYTizZ2
and more simple code: http://pastebin.com/NVJVpfeA

I tested it with another Uno board, different power source (9v battery/USB), different sketches. I also made sure that the board works with a simple timer and no added libraries. on board led on and off every 10 seconds. What could be causing this difference in time?

Serial communications take time. 9600 bps is pretty slow. Sending each char takes about 1ms. You’re sending about 50 chars every time through loop(). This is like doing “delay(50)” in your code. Try upping your Serial rate to 115200. You should see the difference go down by ~10x.

Also, if you’re not using the Serial.println(millis()); line inside your main loop you could comment that out.

Its usually more accurate when I have serial communication on (debug). Otherwise it is off.

It fixed itself when I changed the board to a teensy. Has to be something with the uno.

http://forum.arduino.cc/index.php?topic=393559.0