Ok so I've been messing with bluetooth for the last few days and have consequently been bashing my head against the keyboard.
I wanted to be able to program the Arduino through the bluetooth bee wirelessly, but I'm not sure that it's actually possible. I'll have to try a few more things yet.
Useful resources I have found are
DFRobot bluetooth bee wiki (kind of lacking)
DFRobot bluetooth bee PDF specsheet (extremely useful)
To test everything out I did the following. Upload this sketch to the Arduino.
char val = 'e';
void setup(){
Serial.begin(38400);
Serial.write("AT+UART=38400,0,0\r\n");
Serial.write("AT+ROLE=0");
}
void loop(){
}
This will set the bluetooth module into a slave mode and the baud rate to 38400. I disconnected the FTDI cable and plugged the Bluetooth bee in. I flicked the switch on the bee to "AT Mode", this allows it to be programmed. I then plugged in the battery, waited 5 seconds, and unplugged it. I removed the Bee and plugged the FTDI cable back in.
I then uploaded this sketch.
char val = 'e';
void setup(){
Serial.begin(38400);
digitalWrite(13, LOW);
}
void loop(){
if(Serial.available() > 0){
val = Serial.read();
if(val == 'H'){
digitalWrite(13, HIGH);
}
if(val == 'L'){
digitalWrite(13, LOW);
}
}
delay(250);
Serial.write("loop\r\n");
}
I unplugged the FTDI, and plugged in the Bee. I flicked the switch off of "AT Mode" and plugged the battery in.
I then clicked on the bluetooth icon on my computer and selected "add a new device", the bluetooth bee was listed. Clicking on it, I selected pair with this device using a code. The default code for this bluetooth device is "1234". Once connected I right clicked on it and selected properties. This will give you the COM # you need to talk to the device.
I opened putty from the radio buttons I selected serial. I entered COM4 and 38400. Clicked open.
Bam, now when I hit H the led comes on, L and it goes off.
No comments:
Post a Comment