I'm trying to establish a commands connection between Android & Arduino. The idea is a basic project. It receives commands from Android and sends commands to Android via Bluetooth.
Parts:
- Arduino MEGA
- Bluetooth HC-05
I have an L293D Motor shield, therefore, I'm connecting the TX & RX into the TX1 and RX1. The 5v & Ground are connected.
I'm doing a long press on the HC-05 while connecting the Arduino to the PC. Then, I'm trying to establish a normal connection and trying to apply AT commands, such as changing the name of the Bluetooth connection.
When I write any AT command, I don't get any output back. When I send anything from Android, it does not get printed. (Previous code had Serial1.print and Serial.print to see the output, in this code I removed this)
What's the issue with my approach?
Code:
void setup() {
Serial.begin(9600);
Serial1.begin(38400);
}
void loop() {
if(Serial1.available()){
int inByte = Serial1.read();
Serial.write(inByte);
}
if(Serial.available()){
int inByte = Serial.read();
Serial1.write(inByte);
}
}