Go Down

Topic: Testing the Bluetooth Status (Read 983 times) previous topic - next topic

ram05

Hi everyone, I need some help

I just paired my 2 bluetooth modules. My HC 05 is connected to the Arduino Nano while my HC 06 is connected to the Arduino Mega. I tried to run the sketch below to test the status of the HC 06. The HC 06 module is connected to a 16×2 LCD display.

unfortunately, the HC 06 module status is "inactive"

how could I make this "active"?
thank you in advance

Code: [Select]
#include
#include

#define rxPin 18
#define txPin 19
#define lcd1 30
#define lcd2 31
#define lcd3 32
#define lcd4 33
#define lcd5 34
#define lcd6 35
SoftwareSerial master(rxPin,txPin);
LiquidCrystal lcd(7,8,9,10,11,12);
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
master.begin(9600);
}

void loop() {
master.listen();
if(master.isListening()){
lcd.setCursor(0,0);
lcd.print("Slave BT Status");
lcd.setCursor(0,1);
lcd.print("ACTIVE");
}
else{
lcd.setCursor(0,0);
lcd.print("Slave BT Status");
lcd.setCursor(0,1);
lcd.print("INACTIVE");
}

}

PaulS

Quote
while my HC 06 is connected to the Arduino Mega.
Quote
The HC 06 module is connected to a 16×2 LCD display.
Which is it?
The art of getting good answers lies in asking good questions.

PaulS

Code: [Select]
#include
#include

What is this crap for?

Code: [Select]
SoftwareSerial master(rxPin,txPin);
Why are you ding software serial on hardware serial pins?
The art of getting good answers lies in asking good questions.

MartynC

#3
Aug 08, 2015, 02:57 am Last Edit: Aug 08, 2015, 02:58 am by MartynC
Hi Ram,

I think you copied the sketch from the comment on the other website. Unfortunately, the website did not convert html tags so parts of your code have disappeared.

Post your full code and take it from the Arduino IDE. Post both sketches. The one for the HC-06 and the one for the HC-05.


As Paul mentioned, you do not need to use software serial on the Mega. The Mega has extra hardware serial channels. Pins 18 and 19 are serial1. See Using an Arduino Mega with a HC-05 zs-040 AT Mode




Go Up