Baja RC(Michael Brichta, Adam Clark, Christian Cooper, Trevor Sibel)
Description: A fully functioning Remote Control car with functioning tail and headlights. It runs via a remote control chip that allows it to read four pins as pushbuttons that toggle on and off. When the Arduino reads the pushbutton as toggled it tells it to do certain things as described in the code.
Program:
int motor1 = 2; // Declares the motor pinsint motor2 = 4; //int motor3 = 7; //int motor4 = 8; //int motorpmw = 9 ; // Declares the pins that control the power output of the motorsint motorpmw2 = 10; //int D0 = 15; // Declares the pins for the pushbuttonsint D3 = 13; //int D2 = 12; //int D1 = 14; //int buttonState3 = 0; // Declares the base states of the buttonsint buttonState = 0; //int buttonState2 = 0; //int buttonState4 = 0; //void setup()
{
pinMode(motor1, OUTPUT); // Declares that these pins to provide power to them pinMode(motor2, OUTPUT); // pinMode(motor3, OUTPUT); // pinMode(motor4, OUTPUT); // pinMode(motorpmw, OUTPUT); // pinMode(motorpmw2, OUTPUT); // pinMode(D0, INPUT); // Tells the board to read what is happening to what is attached to this pin pinMode(D3, INPUT); // pinMode(D2, INPUT); // pinMode(D1, INPUT); // } void loop() {
buttonState4 = digitalRead(D0);// sets buttonState equal to the digital read buttonState = digitalRead(D3); // buttonState2 = digitalRead(D1); // buttonState3 = digitalRead(D2);// if (buttonState4 == HIGH) { // If button 4 is pushed this hapens digitalWrite(motor3, HIGH); // Makes the car go forwards digitalWrite(motor4, LOW); // } else{ digitalWrite(motor3, LOW); // Everything stops digitalWrite(motor4, LOW); // } if (buttonState3 == HIGH){ // If button 3 is pushed digitalWrite(motor1, LOW); // makes the motor go Right digitalWrite(motor2, HIGH);
}
if (buttonState2 == HIGH){
digitalWrite(motor1, HIGH); // makes the motor go Left digitalWrite(motor2, LOW);
}
}
Video of it working: http://www.youtube.com/watch?v=csukpPge4GI
Problems: The first problem that we encountered as a group was trying to wire the microchip for the remote we fixed this through trial and error to figure it out.
Figuring out which pin was which push button, which we solved by trial and error.
Another problem was that the buttons would randomly change on us, which we solved by figuring out which button did which.
What we'd like to do given more time/money is: For starters, we would have built our own chassis, mounted cameras and made it considerably larger.