Category

Microcontrollers

Category

In the Arduino library, the Serial object has a method called “flush().”  Often users go throwing it into programs without fully understanding what it does. It doesn’t help that it’s functionality changed when version 1.0 of the Arduino IDE was released.

Does Serial.flush() affect the Transmit Buffer or the Receive Buffer and when do you need to use it?

A popular LED project is the “Larson Scanner.”  This scanner emulates the effect seen on KIT from Knight Rider and the Cylons in Battlestar Galactica.  The code is usually written using “delay()” which means you can’t combine it with anything else.  The following code could be put into a function, called periodically and allow your code to scan while doing other things.