Brake actually effectively shorts the terminals of the motors together, causing them to stop turning
much faster than the
commands do. After a
has been issued, the wheels will also be
stop()
brake()
much harder to turn, allowing the robot to hold position against a slope.
Line Sensor
The RedBotSensor class supports the
line following sensors
included in the kit.
RedBotSensor(int pin);
Pass the constructor the name of the pin to which the sensor is attached, and the library will take
care of the rest.
void setBGLevel();
void setDetectLevel();
The level setting commands take stock of the surface the sensors are over at the moment and try
to characterize it, so the detection of a transition can be automated. For example, if your robot is
going to try to follow a black line on a white surface, run
while the sensor is looking at
setDetectLevel()
the line, and
while the sensor is not looking at the line. The library will attempt to figure
setBGLevel()
out a good rule for calling an edge having been seen.
boolean check();
Returns
if the current reading is consistent with the levels determined during the
true
setDetectLevel()
call, and
otherwise.
false
int read();
Returns the analog level of the sensor, if you prefer to do your own processing on the data.
Accelerometer
Page 13 of 19
Need help?
Do you have a question about the RedBot and is the answer not in the manual?