- Matt Heise and Collin McDonald
- The Robot that we created is a simple one to create, using Ardunios, motors, and wires
- The motor itself uses blink code, and an H-Bridge
;)
- int motor1 = 2;
- int motor2 = 4;
- int motor3 = 5;
- int motor4 = 3;
- int motorpmw = 9;
-
- void setup()
- {
- pinMode(motor1, OUTPUT);
- pinMode(motor2, OUTPUT);
- pinMode(motor3, OUTPUT);
- pinMode(motor4, OUTPUT);
- pinMode(motorpmw, OUTPUT);
- }
-
- void loop()
- {
- analogWrite(motorpmw, 255);
- forward();
- delay(1000);
- halt();
- delay(1000);
- backwards();
- delay(1000);
- halt();
- delay(1000);
- right();
- delay(1000);
- left();
- delay(1000);
-
- }
- void forward()
- {
- digitalWrite(motor1, HIGH);
- digitalWrite(motor2, LOW);
- digitalWrite(motor3, HIGH);
- digitalWrite(motor4, LOW);
- }
- void halt()
- {
- digitalWrite(motor1, LOW);
- digitalWrite(motor2, LOW);
- digitalWrite(motor3, LOW);
- digitalWrite(motor4, LOW);
- }
- void backwards()
- {
- digitalWrite(motor2, HIGH);
- digitalWrite(motor1, LOW);
- digitalWrite(motor4, HIGH);
- digitalWrite(motor3, LOW);
- }
- void right()
- {
- digitalWrite(motor2, HIGH);
- digitalWrite(motor1, LOW);
- digitalWrite(motor3, HIGH);
- digitalWrite(motor4, LOW);
- }
- void left()
- {
- digitalWrite(motor2, LOW);
- digitalWrite(motor1, HIGH);
- digitalWrite(motor3, LOW);
- digitalWrite(motor4, HIGH);
- }
- The Problems:
- wheel did not spin
- bad soldering job
- If we had money then we would buy a better robot base and better wheeels
|
|