1
votes

I'm trying to use an HC-06 JY-MCU bluetooth slave to write to serial using Arduino Uno. I want to pair my MacBook Air with the device and be able to read that data. However, I don't seem to be able to read any serial data when connecting.

On the Arduino, I have the RX/TX from the HC-06 going to digital pins 0 and 1 and power and ground connected to 5V and GND. I am using the following code:

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.write("asdf");
}

On the terminal I can use screen to read the data coming in. However, when I disconnect the serial cable and pair the Bluetooth to the laptop and attempt to screen to view it, I am left with a blank terminal window.

What am I doing wrong / should I be doing?

3

3 Answers

1
votes

Found this thread while searching for a solution to the same problem after several hours of searching and fiddling discovered my error. So hopefully this will help someone else from wasting several hours.

My mistake was a total beginner's error of not thinking things through:

I was connecting (in my case) HC-05 RX pin to the RX pin on my Arduino and The TX pin to the TX pin on the Arduino. But for communication to work the TX pin has to be connected to the RX pin and the RX pin to the TX pin. Once I did this, it worked just fine.

0
votes

i don't think the HC-06 can't communicate with mac. It's the same with iphones, they dont support the correct protocols to like to the HC-06. Apparently bluetooth modules that support bluetooth 4.0 can

0
votes

Try to use the softwareSerial library, it worked for me with the HC-05 Bluetooth Module.

#include <SoftwareSerial.h>

SoftwareSerial newSerial(10, 11); // New RX, TX pins

void setup(){
   newSerial.begin(9600);
}

void loop(){
   newSerial.println("asdf");
}

You have to connect the TX and RX pins to the new RX and TX pins. (10 and 11) instead of 1 and 0. power and ground are the same. And it should work on Macs, like any other pc, you don't need BLE 4.0