This is a simple app to control an Arduino car via Bluetooth. The car has a HC-05 Bluetooth module.
This is the sketch I uploaded to the Arduino board.
char t;
void setup() {
//to run once:
pinMode(13,OUTPUT); //left motors forward
pinMode(12,OUTPUT); //left motors reverse
pinMode(11,OUTPUT); //right motors forward
pinMode(10,OUTPUT); //right motort reverse
Serial.begin(9600);
}
void loop() {
//to run repeatedly:
if(Serial.available()){
t = Serial.read();
Serial.println(t);
}
if(t == 'F'){
digitalWrite(13,HIGH);
digitalWrite(11,HIGH);
}
else if(t == 'B'){
digitalWrite(12,HIGH);
digitalWrite(10,HIGH);
}
else if(t == 'L'){
digitalWrite(11,HIGH);
}
else if(t == 'R'){
digitalWrite(13, HIGH);
}
else if(t == 'S'){
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
}This is the main screen of the app, there are three buttons:
1."Play" button leads to the ControlActivity
2."Connect to Device" leads to the list of available devices
3.Bluetooth icon to disconnect
In this screen you'll find the list of all the available devices you can connect to
In this screen you'll find the buttons to control the car
Icons made by https://www.flaticon.com/authors/surang from https://www.flaticon.com/
Icons made by https://www.flaticon.com/authors/phatplus from https://www.flaticon.com/
Icons made by https://www.flaticon.com/authors/freepik from https://www.flaticon.com/
m



