Download Print this page

Variobot variAnt Instructions Manual page 37

Advertisement

10) Additional Functions of the variAnt Class
run(bool direction);
turn(bool s);
"run(FORWARD)" allows variAnt to move in the sel-
ected direction, either "FORWARD" or "BACKWARD".
"turn(LEFT)" enables variAnt to rotate in the
desired direction, either "LEFT" or "RIGHT".
slowDown(bool s);
By using "slowDown(LEFT)", the speed of the left
motor is reduced until the next left step is taken.
bool getButton(bool s);
bool buttonPressed(bool s);
The function "getButton(LEFT)" indicates whether
the left button is currently pressed or not.
"buttonPressed(LEFT)" without a second parameter
indicates whether the button has just been pressed,
regardless of the duration of the press.
setLed(pos i, bool value=HIGH);
Using "setLed(R1)" turns on the corresponding LED
at the digital output "DR1", while "setLed(R1, LOW)"
turns it off.
The LEDs may need to be set again in each
iteration of the loop function, since they are
automatically reset to "LOW" in the update
function.
setLeds(byte valueL, byte valueR);
Using "setLeds(100, 200)" assigns a brightness
value between 0 and 255 to the first LEDs
connected to the digital outputs "DL0" and "DR0".
showSensors(pos s1=L0, pos s2=R0);
This function utilizes the first digital outputs "DL0"
and "DR0" to represent the chosen sensor values as
brightness levels.

Advertisement

loading
Need help?

Need help?

Do you have a question about the variAnt and is the answer not in the manual?

Subscribe to Our Youtube Channel