Hi, I want to have a script that would run and output the address of the hc-05 so that I can place it to the other hc-05 without having to copy a paste.
Currently I have this which prints out the AT command to the serial monitor. The current output of the ATcommand for the Apprentice's address is: +ADDR:0000:00:000000
What I want to do is grab 0000:00:000000 and replace the colons to commas and place it into masterSerial.print("AT+BIND="+String(APPREN_ADDRESS)+"\r\n"); .
Is this something that is possible? Thank you for your help!
Your post is utterly incoherent but, if it is what you actually want, you can configure HC-05 with a one-shot Arduino programme simply by putting all the AT commands in the setup. I put a delay 1000 between each command.
I am able to print out the address for the Apprentice to the Serial Monitor, but unable to put it into a buffer to then parse it and replace the colon with commas and place it to the master's code to then pair them together.
I am trying to do this because I would need to pair about 40 HC-05s.
You can simply iterate over the character array and replace the ':' with ','.
Then only print from after the first ','. You know that point is after the six characters of "+ADDR:".
Here's a basic example.
void setup() {
char addressRead[] = "+ADDR:98d3:34:905d3f";
Serial.begin(115200);
for (byte i = 0; i <= strlen(addressRead); i++)
{
if (addressRead[i] == ':')
addressRead[i] = ',' ;
}
Serial.println(&addressRead[6]);//print from from after first ':' to end
}
void loop() {}
I saw the post, I just haven't tested it as I needed to save the output of mySerial.print("AT+ADDR?\r\n"); from the serial monitor to a variable and then replace the colon to commas.
You are going to need to send the AT request for the address and then read the response into character array variable. I just demonstrated how to change the ':' to ',' once you have that array.