Remote Control Car by Ian, Wani and Barrett
by PHS_Engineering in Circuits > Arduino
521 Views, 2 Favorites, 0 Comments
Remote Control Car by Ian, Wani and Barrett
For this project we built a remote control car with a sensor so it doesn't hit anything. The car will move forward when we press up on the remote and move backwards when press down on the remote.
Supplies
- Vex Dc kit
- Arduino
- 14 Wires
- Bolts
Build Body of the Car
To build the body of the car we used vex dc kit. First we connected four wheels to the vex plate using nuts and bolts. We placed the bigger wheel in the back and the smaller wheels in the front.
Motor and Battery
Then we connected the motors to the two back wheels with the wires being connected to the breadboard. After doing this we made a little spot for the battery towards the front of the car.
Build Circuit
This is the circuit that we made to control the car. Use this wiring diagram to replicate it.
Code
This is the code we made to make the car go forward and backwards using an IR remote.
#include
int IRPin = 6; //the pin the IR receiver is connected to
int enablePin = 11; // the pin to turn on the car
int in1Pin = 10; //the pin to make the car go forward
int in2Pin = 9; //the pin to make the car go backwards
void setup()
{
Serial.begin(9600);
IrReceiver.begin(IRPin);
pinMode(6,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
}
void loop()
{
if (IrReceiver.decode())
{
int IRcode = IrReceiver.decodedIRData.command;
if (IRcode == 67)
{
Serial.println(IRcode);
}
IrReceiver.resume();
}
int IRcode = IrReceiver.decodedIRData.command;
if (IRcode == 67)
{
digitalWrite(enablePin,HIGH);
digitalWrite(in1Pin,HIGH);
digitalWrite(in2Pin, LOW);
}
else if (IRcode == 68)
{
digitalWrite(enablePin,HIGH);
digitalWrite(in1Pin,LOW);
digitalWrite(in2Pin, HIGH);
}
else
{
digitalWrite(enablePin,HIGH);
digitalWrite(in1Pin,LOW);
digitalWrite(in2Pin, LOW);
}
}