Making Things (Still) Light Up

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.

Blinking out SOS
Blinking out SOS

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.

Switching between green and red LEDs using the push button
Switching between green and red LEDs using the push button

(link to code)

An LED dance party - the button turns them both off
An LED dance party – the button turns them both off

(link to code)

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.

Unreliable input/ouput switch states
Unreliable input/ouput switch states
Successfully switching states with the press of a button
Successfully switching states with the press of a button