#include "AFMotor.h" AF_DCMotor motor_rf(1, MOTOR12_64KHZ); // create motor #1, 64KHz pwm AF_DCMotor motor_lf(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm AF_DCMotor motor_lr(3, MOTOR12_64KHZ); // create motor #3, 64KHz pwm AF_DCMotor motor_rr(4, MOTOR12_64KHZ); // create motor #4, 64KHz pwm void setup() { Serial.begin(9600); // set up Serial library at 9600 bps Serial.println("Motor test!"); motor_rf.setSpeed(200); // set the speed to 200/255 motor_rr.setSpeed(200); // set the speed to 200/255 motor_lr.setSpeed(200); // set the speed to 200/255 motor_lf.setSpeed(200); // set the speed to 200/255 for (int i=0; i<5; i++){ Serial.print("tick"); motor_rf.run(FORWARD); // turn it on going forward motor_rr.run(FORWARD); // turn it on going forward motor_lf.run(FORWARD); // turn it on going forward motor_lr.run(FORWARD); // turn it on going forward delay(1000); Serial.print("tack"); motor_rf.run(BACKWARD); // the other way motor_rr.run(BACKWARD); // the other way motor_lf.run(BACKWARD); // the other way motor_lr.run(BACKWARD); // the other way delay(1000); Serial.print("tock"); motor_rf.run(RELEASE); // stopped motor_rr.run(RELEASE); // stopped motor_lf.run(RELEASE); // stopped motor_lr.run(RELEASE); // stopped delay(1000); } } void loop() {}