This is a short Arduino routine for configuring the bluetooth module over Serial Monitor.
Code Block |
---|
|
// HC-06_Configuration.ino
String command = "";
void setup() {
Serial.begin(9600);
Serial1.begin(57600);
Serial.println("Type AT commands!");
}
void loop() {
if (Serial1.available() > 0) {
while(Serial1.available() > 0) {
command += (char)Serial1.read();
}
Serial.println(command);
command = "";
}
if (Serial.available() > 0){
delay(10); // The delay is necessary to get this working!
Serial1.write(Serial.read());
}
} |