I have recently bought two HC-05 to be able to communicate between two arduino boards. I need to switch one to master mode but after watching tons of videos and tutorials, I just can't get it right !
I get how to enable the AT mode and I know I have to write AT+ROLE=1 to put switch it to master mode but I don't know where I am supposed to write it. I mean am I supposed to write it in the serial monitor of Arduino ? And if so how do I program it ?
For info, I am using an AT mega 2560 and I have a PC.
Thanks for your attention and for your help I hope !
Usually you just type "AT" into a serial monitor and the device (whatever it is comes back with a command prompt, which could
be AT: or anything else but you know it's command prompt if it keeps replying with the same prompt when you hit the carraige
return (called the "ENTER" key these days).
As I said, without reading any instructions , if you THINK it has a serial user interface you just open the monitor and hit RETURN.
IF IT IS ALIVE and IS a serial user interface, it will reply with the same prompt no matter how many times you hit RETURN.
If you enter the correct command at the command prompt it will acknowledge with a confirmation code. Some user interfaces
respond with a command menu if you just enter "?"/RETURN.
I'm not familiar with the device you are on about but...
in very basic terms...
You can upload a program called SerialRelay to your Arduino, and connect that to the device. When you open Serial Monitor anything you send to the Arduino will be sent on to the device, and anything it responds with sent to your screen.
I'm a little bit wiser now - you are aware that it is a 3.3 volt device aren't you? And are you using level shifters on the communication pins? Or is it on a module and you don't need to worry about it? Sending 5 volt signals to a 3.3 volt device won't improve it's life expectancy.
No, you can communicate with it using a Mega. You have other hardware serial ports available, use one of those to connect to your module and amend the SerialRelay code as appropriate? (Remove reference to SoftwareSerial, relay the input to one of the other serial ports)
Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX).
Raschemmel : I've looked at the datasheet, the thing I don't get it when they say "write in the serial" does it mean the serial monitor of Arduino ? Because when I do it it doesn't work.