I'm trying to connect HC-06 Bluetooth Classic Module to R4 WiFi.
This is the code I'm using.
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3);
boolean NewLine = true;
void setup() {
Serial.begin(9600);
while (!Serial) ;
BTSerial.begin(9600);
}
void loop() {
if (Serial.available()) {
char ch = Serial.read();
if (ch != '\r' && ch != '\n') {
BTSerial.write(ch);
}
if (NewLine) {
Serial.print("\n> ");
NewLine = false;
}
if (ch == '\n') {
NewLine = true;
}
Serial.write(ch);
}
if (BTSerial.available()) {
char ch = BTSerial.read();
Serial.write(ch);
}
}
After uploading the code, I cannot get 'OK' when type in 'AT'.
I can get 'OK' with R4 Minima. ![]()
Same code, same Bluetooth classic module, same wiring...
What is the difference between R4 WiFi and R4 Minima?
Did I miss something?
Another interesting thing is that
when I connected the module to Serial1,
I can get 'OK' with R4 WiFi.
Some bug in SoftwareSerial for R4 WiFi ?
Any hint for this?
Thank you in advance.