Last change
on this file since 449 was 136, checked in by ertl-honda, 9 years ago |
ライブラリとOS及びベーシックなサンプルの追加.
|
File size:
732 bytes
|
Line | |
---|
1 | /* Motor Board IR Array Test
|
---|
2 |
|
---|
3 | This example of the Arduno robot's motor board returns the
|
---|
4 | values read fron the 5 infrared sendors on the bottom of
|
---|
5 | the robot.
|
---|
6 |
|
---|
7 | */
|
---|
8 | // include the motor board header
|
---|
9 | #include <ArduinoRobotMotorBoard.h>
|
---|
10 |
|
---|
11 | String bar; // string for storing the informaton
|
---|
12 |
|
---|
13 | void setup() {
|
---|
14 | // start serial communication
|
---|
15 | Serial.begin(9600);
|
---|
16 | // initialize the library
|
---|
17 | RobotMotor.begin();
|
---|
18 | }
|
---|
19 | void loop() {
|
---|
20 | bar = String(""); // empty the string
|
---|
21 | // read the sensors and add them to the string
|
---|
22 | bar = bar + RobotMotor.IRread(1) + ' ' + RobotMotor.IRread(2) + ' ' + RobotMotor.IRread(3) + ' ' + RobotMotor.IRread(4) + ' ' + RobotMotor.IRread(5);
|
---|
23 | // print out the values
|
---|
24 | Serial.println(bar);
|
---|
25 | delay(100);
|
---|
26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.