I have 2 HM10 Bluetooth modules connected to 2 Arduino Teensy running the following code.
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
// If the baudrate of the HM-10 module has been updated,
// you may need to change 9600 by another value
// Once you have found the correct baudrate,
// you can update it using AT+BAUDx command
// e.g. AT+BAUD0 for 9600 bauds
}
void loop() {
char c;
if (Serial.available()) {
c = Serial.read();
Serial1.println(c);
}
if (Serial1.available()) {
c = Serial1.read();
Serial.print(c);
}
}
By pairing them using the AT commands I was able to send messages back and forth by writing to Serial1. However now when I try to send AT commands it will just send the string to the other module instead of replying OK etc. How do I break the connection and make the AT commands work again?
The tutorial I used to pair the modules.
Serial.println()
, Arduino Teensy and etc.) so I think this suits Arduino SE. Neither can I think of a better SE community to answer this question.