Rev | Line | |
---|
[136] | 1 | /*
|
---|
| 2 | Line Following with Pause
|
---|
| 3 |
|
---|
| 4 | As the robot has two processors, one to command the motors and one to
|
---|
| 5 | take care of the screen and user input, it is possible to write
|
---|
| 6 | programs that put one part of the robot to do something and get the
|
---|
| 7 | other half to control it.
|
---|
| 8 |
|
---|
| 9 | This example shows how the Control Board assigns the Motor one to
|
---|
| 10 | follow a line, but asks it to stop every 3 seconds.
|
---|
| 11 |
|
---|
| 12 | Circuit:
|
---|
| 13 | * Arduino Robot
|
---|
| 14 |
|
---|
| 15 | created 1 May 2013
|
---|
| 16 | by X. Yang
|
---|
| 17 | modified 12 May 2013
|
---|
| 18 | by D. Cuartielles
|
---|
| 19 |
|
---|
| 20 | This example is in the public domain
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | #include <ArduinoRobot.h>
|
---|
| 24 | #include <Wire.h>
|
---|
| 25 | #include <SPI.h>
|
---|
| 26 |
|
---|
| 27 | void setup() {
|
---|
| 28 | // initialize the robot
|
---|
| 29 | Robot.begin();
|
---|
| 30 |
|
---|
| 31 | // initialize the screen
|
---|
| 32 | Robot.beginTFT();
|
---|
| 33 |
|
---|
| 34 | // get some time to place the robot on the ground
|
---|
| 35 | delay(3000);
|
---|
| 36 |
|
---|
| 37 | // set the robot in line following mode
|
---|
| 38 | Robot.setMode(MODE_LINE_FOLLOW);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | void loop() {
|
---|
| 42 | // tell the robot to take a break and stop
|
---|
| 43 | Robot.pauseMode(true);
|
---|
| 44 | Robot.debugPrint('p');
|
---|
| 45 | delay(3000);
|
---|
| 46 |
|
---|
| 47 | // tell the robot to move on
|
---|
| 48 | Robot.pauseMode(false);
|
---|
| 49 | Robot.debugPrint('>');
|
---|
| 50 | delay(3000);
|
---|
| 51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.