DEV-13819

int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
Make sure you change the value of 'ledPin' to whatever digital pin your LED is
connected to; in the above example it is tied to pin 13. That sketch should turn the
LED on for a second, off for a second, on for a second, off for a second, and so on.
Note that both LEDs have one leg tied to ground through a 330Ω resistor, and the
other leg connected to either JC2 or JC3 (and then to whatever pin you have them
connected to on your Arduino). This means that you have to 'digitalWrite' the pin
HIGH to turn the LED on, and LOW to turn it off.
Sidenote: The 330Ω resistor is there to limit the current that is allowed to go through
the LED. This is a necessity for just about every LED, as they are prone to blow up if
supplied current that is over their maximum rating (about 20mA for these LEDs).
Using the Button
As with the LEDs, before you can use the button you have to connect it to a digital or
analog pin of your choice. For a perfect example of how to use the button, check out
the 'Button' example (in Arduino go to File->Examples->Digital->Button):
const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
Make sure you change 'buttonPin' and 'ledPin' according to how you've wired them,
the example assumes they're connected to digital pins 2 and 13, respectively.
The button on the ProtoShield is 'pulled high', meaning one side of the button is
connected, through a resistor, to +5V and also to 'JC1' (which should then be
connected to an Arduino pin of your choice). The other end of the button is simply
connected to ground. This means that when the button is pressed it will read as
LOW, otherwise it will be HIGH. In the example above, the LED will be on unless the
button is being pressed.
Using the BlueSMiRF port
Bluetooth is a really simple, and effective way to add wireless communication to your
project. The BlueSMiRF Gold works as, essentially, a serial cable minus the wires.
Only four connections are required to communicate with the BlueSMiRF - 5V, GND,
RX and TX.
When you connect the BlueSMiRF to your ProtoShield, take care to match the 'VCC',
'GND', 'TX-O', and 'RX-I' labels of the BlueSMiRF with the '5V', 'GND', 'D0', and 'D1'
labels of the shield.

DEV-13819

Mfr. #:
Manufacturer:
SparkFun
Description:
SparkFun Accessories Arduino ProtoShield- Bare PCB
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet