Our team consisted of: Melissa Do, Emma Rivera, Cindy Quach, and Alex Thomas. Other than Melissa, the rest of the team had never been to a Hackathon before nor had prior experience with working with hardware. So we approached this opportunity with the goal of learning how to step out of our comfort zones and into the engineering world. Melissa is Cindy's mentor in IEEE. She helped guide us by going over Arduino and breadboard basics prior to starting our RC car project. She provided us with enough guidance, but also made sure that we got out own hands-on experience.

We learned how to program using the Arduino IDE, build simple circuits, the difference between digital and analog signals, and how to solder wires onto our LED lights.

ERROR ADDING OUR CODE:

ARDUINO FILE

char userInput = ' '; int ledRight = 13; int ledLeft = 12; int motor1EN = 7; int motor2EN = 4; int Motor1Logic1 = 6; int Motor1Logic2 = 5; int Motor2Logic1 = 10; int Motor2Logic2 = 11; int M1speed = 255; //default speed HIGH is 255 rpm int M2speed = 255;

void setup() { Serial.begin(9600); pinMode(ledRight, OUTPUT); pinMode(ledLeft, OUTPUT); pinMode(motor1EN, OUTPUT); pinMode(motor2EN, OUTPUT); pinMode(Motor1Logic1, OUTPUT); pinMode(Motor1Logic2, OUTPUT); pinMode(Motor2Logic1, OUTPUT); pinMode(Motor2Logic2, OUTPUT); digitalWrite(motor1EN, LOW); digitalWrite(motor2EN, LOW);

} //five void funtions forward reverse left right and halt void forward() { digitalWrite(ledLeft, LOW); digitalWrite(ledRight, LOW); digitalWrite(motor1EN, HIGH); digitalWrite(motor2EN, HIGH); analogWrite(Motor1Logic1, LOW); analogWrite(Motor1Logic2, M1speed); analogWrite(Motor2Logic1, LOW); analogWrite(Motor2Logic2, M2speed);

}

void back() { digitalWrite(ledLeft, LOW); digitalWrite(ledRight, LOW); digitalWrite(motor1EN, HIGH); digitalWrite(motor2EN, HIGH); analogWrite(Motor1Logic1, M1speed); analogWrite(Motor1Logic2, LOW); analogWrite(Motor2Logic1, M2speed); analogWrite(Motor2Logic2, LOW);

}

void left() { digitalWrite(motor1EN, HIGH); digitalWrite(motor2EN, HIGH); digitalWrite(Motor1Logic1, LOW); //digital is for high and low analogWrite(Motor1Logic2, M1speed); //anaolg is for when you wan to specify a value analogWrite(Motor2Logic1, M2speed); digitalWrite(Motor2Logic2, LOW); }

void right() { digitalWrite(motor1EN, HIGH); digitalWrite(motor2EN, HIGH); analogWrite(Motor1Logic1, M1speed); digitalWrite(Motor1Logic2, LOW); digitalWrite(Motor2Logic1, LOW); analogWrite(Motor2Logic2, M2speed); }

void halt() { digitalWrite(ledLeft, LOW); digitalWrite(ledRight, LOW); digitalWrite(motor1EN, LOW); digitalWrite(motor2EN, LOW); digitalWrite(Motor1Logic1, LOW); digitalWrite(Motor1Logic2, LOW); digitalWrite(Motor2Logic1, LOW); digitalWrite(Motor2Logic2, LOW); }

void loop() { if (Serial.available() > 0) { userInput = Serial.read(); if (userInput == 'f') { halt(); delay(2000); forward(); } else if (userInput == 'b') { halt(); delay(2000); back(); } else if (userInput == 'l') { digitalWrite(ledLeft, HIGH); digitalWrite(ledRight, LOW); halt(); delay(2000); left(); } else if (userInput == 'r') { digitalWrite(ledLeft, LOW); digitalWrite(ledRight, HIGH); halt(); delay(2000); right(); } else if (userInput == 'h') { halt(); }

}

//serial.available //serial.read() returns info input on my phone }

Built With

Share this project:
×

Updates