I wants to use HC05 Bluetooth module with Arduino and I done all thing right, I connected 5v and gnd to Arduino 5v and gnd tx and rx of hc05 to rx and tx of Arduino respectively, and I am able connect it with my phone, but when I am pressing any button from phone the serial monitor showing me ‘?????’ instead of result
My code is:
// Define LED pin
const int ledPin = 13;
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Set LED pin as output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Check if data is available to read
if(Serial.available() > 0) {
// Read incoming data
char incomingByte = Serial.read();
// Print received data to serial monitor
Serial.println(incomingByte);
// Check if incoming data is '1' or '0'
if(incomingByte == '1') {
// Turn on LED
digitalWrite(ledPin, HIGH);
} else if(incomingByte == '0') {
// Turn off LED
digitalWrite(ledPin, LOW);
}
}
}
What could I do to fix it
New contributor
Yaman Verma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.