Arduino‎ > ‎Brewing Arduino‎ > ‎

Prototype Shield - Using on Board Bounce Switch and LED

posted Oct 23, 2010, 3:24 AM by Haris Hashim   [ updated Oct 26, 2010, 12:41 AM ]
Prototype Shield is a very nice addition to Arduino shields (or extension board). It is like a blank piece of paper. This shield is sort of a blank shield with lots of hole for wire wrap and even pads for 28 pin DIP chip and 14 pin SOIC chip. Also very useful are trace of GND and VCC that act as rail for both. Love this as it is easy to test circuit using multimeter as shown by image on the right.

It came with mini breadboard that is self adhesive. In case anyone got bored with wire wraps, simply use the breadboard bonded with adhesive on top of the shield or just leave it bouncing around!

As a shield it come with standard shield connector. Mostly I found that it is very useful to use jumper wire on the connector.  Either connect the digital or analog pins to mini breadboard or one of the wire wrap holes on board. 

However do be cautious not to short anything when jumping around with the wires on life board! I believe in sharing common pitfall of electronic with everyone. It happen to me twice! Windows just complains about power surge on the USB port (yikes!) and display popup that advice to unplug the cable,  reconnect then reset the affected USB hub. In one occasion, I have to restart the notebook to get Uno detected as serial port again.

I got one inquiry about how to use the on board bounce switch and LED. The secrete is to know which of the wire wrap hole correspond to the switch and LEDs. Let bellow picture do the talking.


With the above information, a mini breadboard, some jumper wires and a pull-up resistor we get the following work of arts!


Check the following video and source code after it!



Source Code

// This source code start as example code from Arduino
// Original credit goes to  DojoDave modified by Tom Igoe
// Then I did a minimal modification just to make it works 
// with DFRobot Prototype Shield

// constants won't change. They're used here to 
// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);    
 
 digitalWrite(ledPin, LOW);   
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == LOW) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}




Comments