2
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
#include “RingoHardware.h” //include Ringo background functions
void setup(){
HardwareBegin(); //initialize Ringo’s circuitry
PlayStartChirp(); //play startup chirp and blink eyes
delay(1000); //wait 1 second after restart before starting navigation
NavigationBegin();
//initialize navigation system
}
void loop(){
//direction, speed, distance, runtime, skidtime, edge, wiggle
MoveWithOptions
(
0
,
220
,
300
,
2000
,
100, 0, 10
); // go forward 300 mm
delay(1000);
// wait 1 second
MoveWithOptions
(
0
, -
220
, -
300
,
2000
,
100, 0, 10
); // go backward 300 mm
delay(1000);
// wait 1 second
}
In this example, we call
MoveWithOptions()
and tell it to drive Ringo in the
0
degree heading (straight ahead) at a motor speed of
220
(motor speeds can be
positive or negative
0
to
255
) for a distance of about 300 mm. He will allow 2
seconds to complete the maneuver, allow 100 milliseconds to come to a complete
stop after the maneuver, and he’ll do it all with level 10 buggy swagger. He then
does the same in reverse. To drive in reverse you’ll specify a negaive motor speed
(
-200
in this case) as well as a negative distance (
-300
in this case).
Now lets combine movement and rotation. Like this:
will show. A
0
in this argument will cause him to move fairly straight with only a
minimal wiggle. A
50
in this argument looks pretty buggy - he sways around a lot
more. It is suggested that a maximum value of
100
be passed for this argument.
Anything more than
100
will cause him to have a real problem maintaining course,
but it can be interesting to watch so go ahead and experement with it.
Lets have a look at a working example of this function.
Using Ringo’s Navigation