-
-
Save Drew-S/995995c9c48a3de704f615b3c2622a21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int RIGHT_F = 13; | |
static int RIGHT_B = 12; | |
static int LEFT_F = 8; | |
static int LEFT_B = 9; | |
void setup() | |
{ | |
PinMode(RIGHT_F, output); | |
PinMode(RIGHT_B, output); | |
PinMode(LEFT_F, output); | |
PinMode(LEFT_F, output); | |
} | |
void forward() | |
{ | |
digitalWrite(RIGHT_F, HIGH); | |
digitalWrite(LEFT_F, HIGH); | |
} | |
void backward() | |
{ | |
digitalWrite(RIGHT_B, HIGH); | |
digitalWrite(LEFT_B, HIGH); | |
} | |
void left() | |
{ | |
digitalWrite(RIGHT_F, HIGH); | |
digitalWrite(LEFT_B, HIGH); | |
} | |
void right() | |
{ | |
digitalWrite(RIGHT_B, HIGH); | |
digitalWrite(LEFT_F, HIGH); | |
} | |
void stop() | |
{ | |
digitalWrite(RIGHT_F, LOW); | |
digitalWrite(RIGHT_B, LOW); | |
digitalWrite(LEFT_F, LOW); | |
digitalWrite(LEFT_B, LOW); | |
} | |
void loop() | |
{ | |
forward(); | |
delay(2500); | |
stop(); | |
backward(); | |
delay(2500); | |
stop(); | |
left(); | |
delay(2500); | |
stop(); | |
right(); | |
delay(2500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment