Created
February 28, 2018 19:51
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
#define MOTOR1_SPEED 9 | |
#define MOTOR1_IN1 8 | |
#define MOTOR1_IN2 7 | |
void setup() { | |
pinMode(MOTOR1_SPEED, OUTPUT); | |
pinMode(MOTOR1_IN1, OUTPUT); | |
pinMode(MOTOR1_IN2, OUTPUT); | |
} | |
void motor_clockwise() { | |
digitalWrite(MOTOR1_IN1, LOW); | |
digitalWrite(MOTOR1_IN2, HIGH); | |
} | |
void motor_counterclockwise() { | |
digitalWrite(MOTOR1_IN1, HIGH); | |
digitalWrite(MOTOR1_IN2, LOW); | |
} | |
void motor_stop() { | |
digitalWrite(MOTOR1_IN1, LOW); | |
digitalWrite(MOTOR1_IN2, LOW); | |
} | |
void loop() { | |
motor_clockwise(); | |
delay(1000); | |
motor_stop(); | |
delay(1000); | |
motor_counterclockwise(); | |
delay(1000); | |
motor_stop(); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment