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:
Serial.println(“Button A Pressed”);
You will also need to start serial communication in the 'setup' function by doing this:
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.
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 Arduino, 30 Arduino Projects for the Evil Genius and Programming the Raspberry Pi.
Page last edited October 10, 2012
Text editor powered by tinymce.