this is bluettoth car made by me it works with android or ios phones
I was need in toy but I have ardrino so, why not make this car
VIDEO :REMEMBER THIS VIDEO IS FOR UNDERSTANDING HOW TO MAKE DONOT FOLLOW CODE GIVEN BY THIS VIDEO YOUR CAR WILL NOT WORK.
Instruction :so pls follow the code I have made and remeber to put the motor of 1 and 2 wheel in 3 and 4 section of l293d and put first postive second negative and follow the process respectively but remember wire of second motor put in m4 should be first negative and second postive
and before uploading code donot now connect wires to of hc05 to audrino and when to connect solder the wires of rx and tx on the already soldered ports in base of arduino.
the code is here and remember upload the code when the audrino is connected to sheild and no wire is connected to sheild
Library:code now://*** 1- Documentation
//This program is used to control a robot car using a app that communicates with Arduino trough a bluetooth module
#include <AFMotor.h>
//creates two objects to control the terminal 3 and 4 of motor shield
AF_DCMotor motor1(3);
AF_DCMotor motor2(4);
char command;
void setup()
{
Serial.begin(9600); //Set the baud rate to your Bluetooth module.
}
void loop(){
if(Serial.available() > 0){
command = Serial.read();
Stop(); //initialize with motors stoped
//Change pin mode only if new command is different from previous.
//Serial.println(command);
switch(command){
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
}
}
}
void forward()
{
motor1.setSpeed(255); //Define maximum velocity
motor1.run(FORWARD); //rotate the motor clockwise
motor2.setSpeed(255); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}
void back()
{
motor1.setSpeed(255);
motor1.run(BACKWARD); //rotate the motor counterclockwise
motor2.setSpeed(255);
motor2.run(BACKWARD); //rotate the motor counterclockwise
}
void left()
{
motor1.setSpeed(255); //Define maximum velocity
motor1.run(FORWARD); //rotate the motor clockwise
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}
void right()
{
motor1.setSpeed(0);
motor1.run(RELEASE); //turn motor1 off
motor2.setSpeed(255); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}
void Stop()
{
motor1.setSpeed(0);
motor2.run(RELEASE); //turn motor1 off
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}
READTHE
CODE TO KNOW ABOUT SKILLS USED IN PROGRAMMING
AND THANK YOU NOW
Comments