Connecting up the breadboard to a microcontroller, in this case an Arduino, has opened up all sorts of possibilities! I’m still mostly tinkering with LEDs: making them light up, blink or neither. The simple on/off is an easy way to tell whether the circuit and code is successful.
First up: simple blinking. Based on morse code I made the LED blink out SOS. Short-short-short, long-long-long, short-short-short.

Next up, I was able to toggle between red and green LEDs by simply pressing a button. Taking this a bit further, I turned them into a little dance party.


Another challenge I tackled was the “on-off switching” in which pushing the button toggled (but sustained) the state of the LED. Initially I had trouble with this functioning reliably. The push button seemed to flip the switch to quickly, doubling over on itself. With a little digging, I figured out adding a delay() allowed the circuit to feed in the proper lastState information.

