Bluetooth Car With Mit App Inventor(block Code App Maker) and Arduino.
by swastikchakraborty1203 in Circuits > Arduino
884 Views, 3 Favorites, 0 Comments
Bluetooth Car With Mit App Inventor(block Code App Maker) and Arduino.
This car uses Hc05 Bluetooth module. The app used is made with MIT App inventor. It is a block code app which can be used to make apps for various purposes.
Supplies
Arduino Uno
Hc-05 Bluetooth
Motors
Motor driver
Now, I am assuming you have basic knowledge of Arduino. The wiring of motor driver and Arduino is given in the code.
If you don't know how to use an Arduino, there are plenty of articles in the internet about it.
Code
char t;
void setup() {
pinMode(13,OUTPUT); //left motors forward
pinMode(12,OUTPUT); //left motors reverse
pinMode(11,OUTPUT); //right motors forward
pinMode(10,OUTPUT); //right motors reverse
pinMode(9,OUTPUT); //Led
Serial.begin(9600);
}
void loop() {
if(Serial.available()){
t = Serial.read();
Serial.println(t);
}
if(t == 'F'){ //move forward(all motors rotate in forward direction)
digitalWrite(13,HIGH);
digitalWrite(11,HIGH);
}
else if(t == 'B'){ //move reverse (all motors rotate in reverse direction)
digitalWrite(12,HIGH);
digitalWrite(10,HIGH);
}
else if(t == 'L'){ //turn right (left side motors rotate in forward direction, right side motors doesn't rotate)
digitalWrite(11,HIGH);
}
else if(t == 'R'){ //turn left (right side motors rotate in forward direction, left side motors doesn't rotate)
digitalWrite(13,HIGH);
}
else if(t == 'W'){ //turn led on or off)
digitalWrite(9,HIGH);
}
else if(t == 'w'){
digitalWrite(9,LOW);
}
else if(t == 'S'){ //STOP (all motors stop)
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
delay(100);
}
MIT App Inventor
You can use the MIT App inventor to create an app that will send signals to the arduino if you have basic knowledge of MIT App Inventor. Or you can just download the app from here.
https://drive.google.com/file/d/1-DmnLtBzIBJTTe_ZWne-pzoZ5YK4l_Jw/view?usp=drivesdk
If you want to design your own app here's how you can do it.
Designing the App
You will first have to add the elements such as buttons and labels as given in the above image. You will have to insert 4 buttons and 1 list picker (to show available devices.) as given above. After doing this you will need to move to the 'blocks' window where you need to code the app.
Block Code
After designing the app, you need to code it. The block code is given above. It will help to select a device using the list picker and then send commands to the arduino using bluetooth. Based on these commands, the car will move forward, backward, left or right.