Last active
October 16, 2015 01:57
-
-
Save gamgoon/e9c1536e84ef53ee7207 to your computer and use it in GitHub Desktop.
L298N Dual Motor Controller Module and Arduino
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
const int IN1 = 7; | |
const int IN2 = 8; | |
const int ENA = 9; | |
void setup() { | |
pinMode(IN1, OUTPUT); | |
pinMode(IN2, OUTPUT); | |
pinMode(ENA, OUTPUT); | |
} | |
void loop() { | |
// forward | |
digitalWrite(7, LOW); | |
digitalWrite(8, HIGH); | |
analogWrite(9, 80); | |
delay(1000); | |
// reverse | |
digitalWrite(7, LOW); | |
digitalWrite(8, HIGH); | |
analogWrite(9, 80); | |
delay(1000); | |
// stop | |
digitalWrite(7, HIGH); | |
digitalWrite(8, HIGH); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment