DEV-13819

You can use the standard 'Serial.print' and 'Serial.read' commands to send and
receive serial data. Here's an example that builds on the previous code, adding serial
communication:
intledPin=13;
intbuttonPin=2;
intbuttonState=LOW;
intoldButtonState=HIGH;
charserInput;
voidsetup()
{
pinMode(ledPin,OUTPUT);
pinMode(buttonPin,INPUT);
digitalWrite(ledPin,HIGH);
Serial.begin(115200);
}
voidloop()
{
buttonState=digitalRead(buttonPin);
if(Serial.available()>0)
{
serInput=Ser ial.read();
Serial.println("Miny,Moe.");
}
if(butto
nState!=oldButtonState)
{
if(buttonState==HIGH)
{
digitalWrite(ledPin,HIGH);
Serial.print("Meeny,");
}
else
{
digitalWrite(ledPin,LOW);
Serial.print("Eeny,");
}
}
oldButtonState= buttonState;
}
This example will actually work with both the standard USB serial connection, or a
BlueSMiRF. Give it a try! Note that the baud rate is set to 115200 bps, this is the
default baud rate of the BlueSMiRF. Pressing the button will turn the LED off and
send "Eeny, " out the serial port. Releasing the button will turn the LED back on and
print "Meeny, ". Sending any character to the Arduino, over a serial connection, will
print "Miny, Moe.".
If you want to communicate between your computer and the BlueSMiRF, you will
need a bluetooth dongle of some sort. Many options exist to add bluetooth to your
computer (if it doesn't already have it). For beginners, I'd recommend the Bluetooth
USB module; another, more advanced, option is the USB BlueDongle.
How have others used the shield?
The ProtoShield can be used to prototype just about any Arduino project you could
imagine. As examples of the huge variety of projects the shield has been used for,
check out these links:
Arduino USB Host
Ultrasonic Range Finder Tape measure
Joystick Control of Servo Motors
•4-Bit Maze
Temperature Monitor/Controller
Weather Station Receiver
Basic 555 Timer
Do you have an example you'd like posted here? Drop us an email!
Schematic and PCB Layout
For technical information including the schematic and design files, please see the
product page. You may also want to add/review the comments on that page or do a
Google search for more example projects that use the ProtoShield.
Have a suggestion for how we can improve this quickstart guide? Concepts not
explained clearly? Need more example code? Please let us know. You can leave a
comment below or email us spark@sparkfun.com. Also let us know if this is the most
awesome Quickstart guide you have ever encountered and we will stop trying to
improve it.
2
/
12
/
201
5
htt
p
s://www.s
p
arkfun.com/tutorials/191

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