Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int motorA = 5;
- const int motorB = 6;
- const int dirA = 7;
- const int dirB = 8;
- void setup() {
- pinMode(motorA, OUTPUT);
- pinMode(motorB, OUTPUT);
- pinMode(dirA, OUTPUT);
- pinMode(dirB, OUTPUT);
- }
- void loop() {
- digitalWrite(dirA, HIGH);
- digitalWrite(dirB, HIGH);
- analogWrite(motorA, 150);
- analogWrite(motorB, 150);
- delay(1000);
- analogWrite(motorA, 0);
- analogWrite(motorB, 0);
- delay(1000);
- digitalWrite(dirA, LOW);
- digitalWrite(dirB, LOW);
- analogWrite(motorA, 150);
- analogWrite(motorB, 150);
- delay(1000);
- analogWrite(motorA, 0);
- analogWrite(motorB, 0);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement