APPENDIX C. COMMAND OVERVIEW
32
C.1
Class BobbyBoard
Class:
BobbyBoard
File:
qfixBobbyBoard.h
RValue
Method
Description
BobbyBoard()
This constructor is called automatically
when the object is created. It initializes the
object as follows: The motors are set to 0,
all LEDs are off, all power outputs are on.
void
ledOn(int i)
Puts on LED with index
i
.
i
must be in
the range 0 to 3.
void
ledOff(int i)
Puts off LED with index
i
.
i
must be in
the range 0 to 3.
void
ledsOff()
Puts off all LEDs.
void
led(int i, bool state)
Puts on LED with index
i
if
state=true
,
else off.
i
must be in the range 0 to 3.
bool
button(int i)
Returns
true
if the button with index
i
is
pressed, else
false
.
i
must be in the
range 0 to 3.
bool
waitForButton(int i)
Waits until the button with index
i
is
pressed and released again.
i
must be
in the range 0 to 3.
void
motor(int i, int speed)
Sets the motor with index
i
to the value
speed
which must be in the range -255 to
+255. A value of 0 puts off the motor..
void
motors(int motor0, int motor1)
Sets both motors to the respective values
motor0
and
motor1
. Both values must be
in the range -255 to +255.
void
motorsOff()
Puts off both motors.
int
analog(int i)
Returns the value of the analog input with
index
i
. The returned value is in the range
0-255.
i
must be in the range 0 to 3.
bool
digital(int i)
Returns
true
if the digital input with index
i
is high (+5V), else
false
.
i
must be in
the range 0 to 3.
void
powerOn(int i)
Puts on the power output with index
i
.
i
must be in the range 0 to 7.
void
powerOff(int i)
Puts off the power output with index
i
.
i
must be in the range 0 to 7.
void
power(int i, bool state)
Puts on the power output with index
i
if
state=true
.
i
must be in the range 0 to
7.
void
ledMeter(int i)
Displays the given value in the range 0-
255 using the four LEDs.
void
sleep(int s)
Waits for
s
seconds.
void
msleep(int ms)
Waits for
ms
milliseconds.