Other Things to Do

There are a couple of things we could try with this hardware.

Firstly, you could try taking what you learnt in lesson 5 and adding some commands to the sketch that print something to the Serial Monitor whenever either switch is pressed.

Remember that as well as printing out a message using something like this in your 'loop' function:

Download: file
Serial.println(“Button A Pressed”);

You will also need to start serial communication in the 'setup' function by doing this:

Download: file
while (!Serial);
Serial.begin(9600);

A second modification that you could make would be to make the buttons do something different. So, for example you could change the sketch so that if button A is pressed, the LED turns on, but then turns off again after 30 seconds.

Hint: Think of this as being a very slow blink.

About the Author

Simon Monk is author of a number of books relating to Open Source Hardware. The following books written by Simon are available from Adafruit: Programming Arduino30 Arduino Projects for the Evil Genius and Programming the Raspberry Pi.

This guide was first published on Dec 05, 2012. It was last updated on Dec 05, 2012. This page (Other Things to Do) was last updated on Jul 16, 2019.