It is a simple project which can be done by following the below steps:
1. Simply connect the wires as shown in schematics.
2. Upload the code given in description.
void setup() {
Serial.begin(9600);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
void loop() {
if(Serial.available()>0)
{
char data=Serial.read();
Serial.println(data);
if(data=='f')
{
digitalWrite(2,HIGH);
digitalWrite(6,HIGH);
digitalWrite(3,LOW);
digitalWrite(7,LOW);
}
if(data=='b')
{
digitalWrite(3,HIGH);
digitalWrite(7,HIGH);
digitalWrite(2,LOW);
digitalWrite(6,LOW);
}
if(data=='s')
{
digitalWrite(2,LOW);
digitalWrite(6,LOW);
digitalWrite(3,LOW);
digitalWrite(7,LOW);
}
if(data=='l')
{
digitalWrite(2,LOW);
digitalWrite(6,HIGH);
digitalWrite(3,LOW);
digitalWrite(7,LOW);
}
if(data=='r')
{
digitalWrite(2,HIGH);
digitalWrite(6,LOW);
digitalWrite(3,LOW);
digitalWrite(7,LOW);
}
}
}
3. Dowload the app the link:
https://play.google.com/store/apps/details?id=com.giumig.apps.bluetoothserialmonitor&hl=en
>>first of all connect the bluetooth to the HC-05 shown in available device list, if it asks for password enter 1234 or 0000.
>>after connecting, click on the terminal option, then control the bot by giving the command like 'f' for forward and 'b' for backward etc.
Comments