0% found this document useful (0 votes)
42 views1 page

Code For Arduino Blootooth Controlled RC Car

This document contains an Arduino sketch for controlling a robot's motors and an LED based on serial input commands. The robot can move forward, backward, turn left or right, stop, and toggle an LED on or off. The setup function initializes the motor and LED pins, while the loop function processes serial commands to control the robot's movements.

Uploaded by

godnitinary7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views1 page

Code For Arduino Blootooth Controlled RC Car

This document contains an Arduino sketch for controlling a robot's motors and an LED based on serial input commands. The robot can move forward, backward, turn left or right, stop, and toggle an LED on or off. The setup function initializes the motor and LED pins, while the loop function processes serial commands to control the robot's movements.

Uploaded by

godnitinary7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

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
[Link](9600);

void loop() {
if([Link]()){
t = [Link]();
[Link](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);
}

You might also like