Hardware Reference
In-Depth Information
Just like the control board, to use the Arduino Robot motor board, you must
use functions from the RobotMotor class. The functions are accessed through
the object directly, so there is no need to call the constructor. However, to begin
using the Arduino Robot-specii c functions, you must again i rst call begin() .
RobotMotor.begin();
To retrieve instructions from the control board, use parseCommand() .
RobotMotor.parseCommand();
This function takes no parameters and does not return any data. It is used
simply to read and update internal registers. After commands have been parsed,
it is necessary to act on those instructions; this is achieved with process() .
RobotMotor.process();
Again, this instruction does not take any parameters and does not return
information. It operates the motors depending on the internal results of
parseCommand() .
These two instructions are, in fact, the basis of the default motor board sketch.
#include <ArduinoRobotMotorBoard.h>
void setup(){
RobotMotor.begin();
}
void loop(){
RobotMotor.parseCommand();
RobotMotor.process();
}
This sketch simply reads instructions from the control board and acts on
those instructions. Why is there a separate board in this case? Although the
microcontrollers on these boards are powerful, it is often a good idea to keep
the functions separate; one microcontroller powers the control board, the other
powers the motor board. The motor board performs instructions and continues
to do so until instructed otherwise. The control board can perform advanced
calculations or perform blocking functions while the motor board continues to
monitor the DC motors.
Example Program and Exercises
The Arduino Robot is a superb platform and ready for tinkering. With a large
number of inputs, it is easy and fun to create sketches giving your robot free-
dom of movement. For this application, you create a remote controlled Arduino
 
Search WWH ::




Custom Search