I'm trying to get my bluetooth module into command mode. I have pin 0(RX) on the Uno connected to the UART_TX pin on the bluetooth module, and pin 1(TX) on the Uno connected to the UART_RX pin on the bluetooth module.
Heres the sketch thats running on the Uno.
int incomingByte = 0; // for incoming serial data
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
Serial.flush();
//enter command mode
Serial.println("$$$");
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
//read the incoming byte:
incomingByte = Serial.read();
//say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
This is what I see on the Serial Monitor
$$$
I expected to see
$$$
I received: C
I received: M
I received: D
What am I doing wrong? Or if its not supposed to do what I expected, what am I not understanding correctly?