1AF_DCMotor motor(1);
2
3void setup() {
4 Serial.begin(9600); // set up Serial library at 9600 bps
5 Serial.println("Motor test!");
6
7 // turn on motor
8 motor.setSpeed(200);
9
10 motor.run(RELEASE);
11}
12
13void loop() {
14 uint8_t i;
15
16 Serial.print("tick");
17
18 motor.run(FORWARD);
19 for (i=0; i<255; i++) {
20 motor.setSpeed(i);
21 delay(10);
22 }
23
24 for (i=255; i!=0; i--) {
25 motor.setSpeed(i);
26 delay(10);
27 }
28
29 Serial.print("tock");
30
31 motor.run(BACKWARD);
32 for (i=0; i<255; i++) {
33 motor.setSpeed(i);
34 delay(10);
35 }
36
37 for (i=255; i!=0; i--) {
38 motor.setSpeed(i);
39 delay(10);
40 }
41
42
43 Serial.print("tech");
44 motor.run(RELEASE);
45 delay(1000);
46}
47