Motor Drivers

From STEAMwiki
Jump to: navigation, search

Here's a simple loop that turns your motor one way for 5 seconds, then waits for 5seconds and then turns it the other way for 5 seconds, then waits for 5 seconds.

void setup() {
  pinMode(D0, OUTPUT);
  pinMode(D1, OUTPUT);
}
void loop() {
    digitalWrite(D1, HIGH);
    digitalWrite(D0, LOW);
    delay(5000);
    digitalWrite(D1, LOW);
    digitalWrite(D0, HIGH);
    delay(5000);
}