source: rtos_arduino/trunk/arduino_lib/libraries/Robot_Control/examples/learn/IRArray/IRArray.ino@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 940 bytes
Line 
1/*
2 IR array
3
4 Read the analog value of the IR sensors at the
5 bottom of the robot. The also-called line following
6 sensors are a series of pairs of IR sender/receiver
7 used to detect how dark it is underneath the robot.
8
9 The information coming from the sensor array is stored
10 into the Robot.IRarray[] and updated using the Robot.updateIR()
11 method.
12
13 Circuit:
14 * Arduino Robot
15
16 created 1 May 2013
17 by X. Yang
18 modified 12 May 2013
19 by D. Cuartielles
20
21 This example is in the public domain
22 */
23
24#include <ArduinoRobot.h>
25#include <Wire.h>
26#include <SPI.h>
27
28void setup() {
29 // initialize the robot
30 Robot.begin();
31
32 // initialize the serial port
33 Serial.begin(9600);
34}
35
36void loop() {
37 // store the sensor information into the array
38 Robot.updateIR();
39
40 // iterate the array and print the data to the Serial port
41 for (int i = 0; i < 5; i++) {
42 Serial.print(Robot.IRarray[i]);
43 Serial.print(" ");
44 }
45 Serial.println("");
46}
Note: See TracBrowser for help on using the repository browser.