9.9 Example: motorReverser
/* motorReverser This script will cause the motor to spin in one direction for five seconds then spin in the other direction for three seconds, then repeat. */ #define MOTORA1 13 #define MOTORA2 12 void setup(){ pinMode(MOTORA1, OUTPUT); pinMode(MOTORA2, OUTPUT); } void loop(){ digitalWrite(MOTORA1, HIGH); digitalWrite(MOTORA2, LOW); delay(5000); digitalWrite(MOTORA1, LOW); digitalWrite(MOTORA2, HIGH); delay(3000); }