Hi! I've read a lot of threads and I have seen a lot of information but none seems to work.
I have two hc05 modules because I want to do a master/slave code, where I will be sending sensors data from one to another, with 2 arduino unos.
The problem is, I'm trying to program them to be master/slave but it's not working.
It is at the AT mode already, with the blinking every two seconds, but when I insert the commands to program it for the master/slave nothing shows up on the serial. I don't know what I'm doing wrong.
I'm connecting the hc05 RX to the 3.3V directly on the arduino. Is that the problem? Shouldn't it be the same as doing a divisor with the 5V?
I don't have a code because I've seen a lot of videos where they do this in empty code.
Like he did on that video.
A lot of people made videos like that.
Anyways, I've tried this one.
//Caution: Tx of the module is to connec twithpin 10 of the arduino and RX with pin 11
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(1, 0); // TX | RX
void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
Serial.begin(115200);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command more
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
//Take the string returned by the module and print it
Serial.println(BTSerial.readString());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.println(Serial.readString());
}
The TX signal on the arduino is ON and if I switch the pin 0 and 1 the RX goes on instead.
I have the RX connected to the pin, the 3.3V and GND so I think it's fine.
Anyone can help? I'm also receiving a lot of "???????" when I use this code. I've tried all baud rates.
Well, it certainly isn't a problem at the moment. The real problem is that you don't know what you are doing. Check the Martyn Currey website about HC05 <> HC0x auto-connect. You may not need pin34.