I have bluetooth HC-05 Connected on pins 2 & 3 on Arduino Uno
I send data ( numbers ) from mobile application
And i read the data and use it in switch case to move a car
But the response is very slow that the car moves too much after i click the button in the app
Especially when i switch from one button to another
In another word change the value recieved
// Bluetooth
#include <SoftwareSerial.h>
SoftwareSerial HC05(2,3) ;
String data ;
int Data;
void setup() {
Serial.begin (9600) ;
HC05.begin (9600) ;
}
void loop() {
if (HC05.available()>0) {
data = HC05.readString() ;
Data = data.toInt();
// Serial.println (Data);
}
switch (Data)
{
case 1:
Forward ();
Serial.println("Forward");
break;
case 2:
Left ();
Serial.println("Right");
break;
case 3:
Stop ();
Serial.println("Left");
break;
case 4:
Right ();
Serial.println("Backward");
break;
case 5:
Backward ();
Serial.println("Stop");
break;
case 6:
get_RFID_name ();
break;
}
}