17 Jun 2010 Mubot   » (Master)

Bluetooth is go!

I've been tinkering around in the lab with the parallax EASYBT bluetooth module... got it up and running with both the BOE BOT/BS2 and the Arduino.

here is what i used...and a look at my connections

char val; // variable to receive data from the serial port
int ledpin = 13; // on-board LED
void setup() {

pinMode(ledpin, OUTPUT); // pin 13 (on-board LED) as OUTPUT
Serial.begin(9600); // start serial communication at 9600bps

}
void loop() {

if( Serial.available() ) // if data is available to read
{
val = Serial.read(); // read it and store it in 'val'
}
if( val == 'L' ) // if 'L' was received
{
digitalWrite(ledpin, LOW); // turn OFF the LED
} else {
digitalWrite(ledpin, HIGH); // otherwise turn it ON
}
delay(100); // wait 100ms for next reading


i was unable to figure out how to set the com port on the arduino ide serial terminal, so i used and external terminal program (tera term) and it worked with ease!

Syndicated 2010-03-25 18:16:00 (Updated 2010-04-01 01:31:50) from The Learned Nerd

Latest blog entries     Older blog entries

X
Share this page