Hi Mike,
I’ve followed your steps, made the same mistakes, found the same workarounds, regarding Arduino bluetooth connection to Win7. In my case, I am using a HC-05 modem on this board :
http://www.ebay.com/itm/HC-05-Bluetooth-Transceiver-Host-Slave-Master-Module-Wireless-Serial-6pin-/221158958927.
I’ve had the same issues as you about understanding how to create COM ports, why you get 2 COM ports instead of one, how to get them paired… and I had the same success eventually, using the following flow
- add the BT modem to the computer WITHOUT code.
=> two ports get created (say COM5 with the “DEV” indication, and COM6)
- launch a terminal (I use Tera Term) – connect to COM5 – code is asked, input 1234
=> LED stop blinking, indicating pairing
- using terminal, I am able to see both incoming and outgoing flow (eg, the code below allows me to read numbers, reset them, and turn on/off the led 13)
=> I confirm that my BT dongle, my BT modem, and Arduino sketch, are working
Where things break down
- neither Processing nor Arduino IDE “see” COM5, only COM6. Processing, through Serial.list(), Arduino, in Tools/Ports
- Processing can be forced to connect to COM5 with new Serial(this, “COM5″, 9600), but it does not lead to windows asking for a bluetooth code, and the pairing of the modem. As a consequence, the LED keeps on blinking, and no data is exchanged.
I think this is where you were on April 6 2012, per your blog post. I understand from your following blog psots that you did find a solution. Any ideas?
—- example Arduino code —
/***********************
Bluetooth test program
***********************/
int counter = 0;
int incomingByte;
int pinLED = 13;
boolean allumeLED = true;
void setup() {
Serial.begin(9600);
pinMode(pinLED, OUTPUT);
}
void loop() {
// see if there’s incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// if it’s a capital R, reset the counter
if (incomingByte == ‘R’) {
Serial.println(“RESET”);
counter=0;
}
else if (incomingByte == ’1′) {
allumeLED = true;
}
else if (incomingByte == ’0′) {
allumeLED = false;
}
}
Serial.println(counter);
digitalWrite(pinLED, allumeLED);
counter++;
delay(250);
}
—- example Processing code —
import processing.serial.*;
Serial myPort;
String data;
void setup(){
size(800, 200);
background(255);
// List all the available serial ports:
println(Serial.list());
// Open the port you are using at the rate you want:
myPort = new Serial(this, “COM5″, 9600);
myPort.clear();
myPort.bufferUntil(‘\n’); //read one line at a time
}
void draw(){
background(255);
fill(0);
if (data != null){
text(data, 10, 10);
}
else{
text(“no data”, 10, 10);
}
}
void serialEvent(Serial port){
data = port.readString(); //one line has been buffered
}