Hi guys, my hc-05 can't communicate with application, is there any suggestions? please help me (im beginner) thankyou
If You post
Schematics
Code
we will ha a fair chanse to answer.
code
// Define motor pins
#define motorA1 7 // IN1
#define motorA2 6 // IN2
#define motorB1 5 // IN3
#define motorB2 4 // IN4
#define ENA 8 // PWM for motor A
#define ENB 3 // PWM for motor B
void setup() {
Serial.begin(9600); // Start Bluetooth communication
pinMode(motorA1, OUTPUT);
pinMode(motorA2, OUTPUT);
pinMode(motorB1, OUTPUT);
pinMode(motorB2, OUTPUT);
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
}
void loop() {
if (Serial.available()) {
char command = Serial.read(); // Read command from Bluetooth
controlMotors(command);
}
}
void controlMotors(char command) {
switch (command) {
case 'F': // Move Forward
digitalWrite(motorA1, LOW);
digitalWrite(motorA2, HIGH);
digitalWrite(motorB1, HIGH);
digitalWrite(motorB2, LOW);
analogWrite(ENA, 255); // Set speed (max)
analogWrite(ENB, 255); // Set speed (max)
break;
case 'B': // Move Backward
digitalWrite(motorA1, HIGH);
digitalWrite(motorA2, LOW);
digitalWrite(motorB1, LOW);
digitalWrite(motorB2, HIGH);
analogWrite(ENA, 255); // Set speed (max)
analogWrite(ENB, 255); // Set speed (max)
break;
case 'L': // Turn Left
digitalWrite(motorA1, LOW);
digitalWrite(motorA2, HIGH);
digitalWrite(motorB1, LOW);
digitalWrite(motorB2, HIGH);
analogWrite(ENA, 255); // Set speed (max)
analogWrite(ENB, 255); // Set speed (max)
break;
case 'R': // Turn Right
digitalWrite(motorA1, HIGH);
digitalWrite(motorA2, LOW);
digitalWrite(motorB1, HIGH);
digitalWrite(motorB2, LOW);
analogWrite(ENA, 255); // Set speed (max)
analogWrite(ENB, 255); // Set speed (max)
break;
case 'S': // Stop
digitalWrite(motorA1, LOW);
digitalWrite(motorA2, LOW);
digitalWrite(motorB1, LOW);
digitalWrite(motorB2, LOW);
break;
default: // Default case
break;
}
}
When i want to connect the bluetooth to my phone, LED light on hc-05 turn into 2 times beep and down. at the same time, in my phone the bluetooth not Pairing but Saved. I don't know where is the wrong one
What is your application?
What kind of phone, Android or IOS?
I don't see the schematics requested.
There is a thread hereabouts that features the same motor controller
HC-05 not working with some apps?
Note that it is good practice to include a voltage divider in Arduino Tx line, as shown in post #8.
AND read post #9 again....
I use android
See post #7
i still can't connect... is it possible that the problem is on the HC-05 bluetooth module?
im using many applications, i tried app from Giristudio, AppsValley, Giumig dev app, and etc
Yes. There was another person on the forum with a very similar problem. The HC-05 module would only work with a serial terminal app.
However if you cannot pair with the HC-05 nothing will work.
should i change the hc-05?
You may have damaged the HC-05 with your incorrect wiring. Before you buy a new one, disconnect the TX and RX wires and see if you can pair with HC-05.
If you can't, then it may be a good idea to buy a new one from a different seller.
how if i already bought but still same problem?
Not sure what you are saying.
Do you mean you already have another one and you have the same problem.
The gold standard Android app is Kai Morich's SerialBluetoothTerminal.
https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=en_US
Can you get the module to connect and communicate with that app?

