Last change
on this file since 206 was 136, checked in by ertl-honda, 9 years ago |
ライブラリとOS及びベーシックなサンプルの追加.
|
File size:
827 bytes
|
Line | |
---|
1 | /*
|
---|
2 | Motor Test
|
---|
3 |
|
---|
4 | Just see if the robot can move and turn.
|
---|
5 |
|
---|
6 | Circuit:
|
---|
7 | * Arduino Robot
|
---|
8 |
|
---|
9 | created 1 May 2013
|
---|
10 | by X. Yang
|
---|
11 | modified 12 May 2013
|
---|
12 | by D. Cuartielles
|
---|
13 |
|
---|
14 | This example is in the public domain
|
---|
15 | */
|
---|
16 |
|
---|
17 | #include <ArduinoRobot.h>
|
---|
18 | #include <Wire.h>
|
---|
19 | #include <SPI.h>
|
---|
20 |
|
---|
21 | void setup() {
|
---|
22 | // initialize the robot
|
---|
23 | Robot.begin();
|
---|
24 | }
|
---|
25 |
|
---|
26 | void loop() {
|
---|
27 | Robot.motorsWrite(255, 255); // move forward
|
---|
28 | delay(2000);
|
---|
29 | Robot.motorsStop(); // fast stop
|
---|
30 | delay(1000);
|
---|
31 | Robot.motorsWrite(-255, -255); // backward
|
---|
32 | delay(1000);
|
---|
33 | Robot.motorsWrite(0, 0); // slow stop
|
---|
34 | delay(1000);
|
---|
35 | Robot.motorsWrite(-255, 255); // turn left
|
---|
36 | delay(2000);
|
---|
37 | Robot.motorsStop(); // fast stop
|
---|
38 | delay(1000);
|
---|
39 | Robot.motorsWrite(255, -255); // turn right
|
---|
40 | delay(2000);
|
---|
41 | Robot.motorsStop(); // fast stop
|
---|
42 | delay(1000);
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.