Smart Robo racer

TLMXB006

In Jugaadu's School, there is a Robo race competition were some obstacles are placed in the path. The Robot has to clear path to go ahead. Jugaadu wants to participate in the competition. Can you help him to prepare such a robot?
Networking kit and Robotics Kit
  1. Make a robotic car using a robotic kit.
  2. connect motor driver, Arduino, Bluetooth module, battery, servomotor with an arm on a breadboard and fix it on the robotic car.
  3. Switch it ON and test the bot by installing Bluetooth controlling application in a smart phone.

    

#include <SoftwareSerial.h>

#include <Servo.h>

SoftwareSerial BlueTooth(0,1);

Servo myservo;

int pos = 90; 

char BT_input;

int motorPin1 = 4;

int motorPin2 = 5; 

int motorPin3 = 6;

int motorPin4 = 7; 

void setup()

{

BlueTooth.begin(9600); 

Serial.begin(9600);

pinMode(motorPin1, OUTPUT);

pinMode(motorPin2, OUTPUT);

pinMode(motorPin3, OUTPUT);

pinMode(motorPin4, OUTPUT);

myservo.attach(9);

}

void loop() {

if (BlueTooth.available())

{

BT_input=BlueTooth.read();

if (BT_input=='f')//forward

{

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, LOW);

Serial.println("running");

}

else if (BT_input=='b')//backward

{

digitalWrite(motorPin1, HIGH);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, HIGH);

}

else if (BT_input=='r')//right

{

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

}

else if (BT_input=='l')//left

{

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, LOW);

}

else if (BT_input=='s')//stop

{

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

}

else if (BT_input=='m')

{

for (pos = 90; pos <= 180; pos += 1)

myservo.write(pos); 

}

else if (BT_input=='n')

{

for (pos = 180; pos >= 90; pos -= 1)

myservo.write(pos); 

}}}

.rTable { display: table; width: 100%;} .rTableRow { display: table-row; } .rTableHeading { background-color: #ddd; display: table-header-group; } .rTableCell, .rTableHead { display: table-cell; padding: 3px 10px; border: 1px solid #999999; } .rTableHeading { display: table-header-group; background-color: #ddd; font-weight: bold; } .rTableFoot { display: table-footer-group; font-weight: bold; background-color: #ddd; } .rTableBody { display: table-row-group; }