Page 58
KIPR Link Main Library Functions
(alphabetic order - Math functions are from the C math library and are also automatically included)
a_button [Category: Sensors]
Format:
int
a_button();
Reads the value (0 or 1) of the A button.
a_button_clicked [Category: Sensors]
Format:
int
a_button_clicked();
Gets the A button's state (pressed or not pressed). If pressed, blocks until released. Returns 1
for pressed, 0 for not pressed. The construction
w
hile
(a_button()==0) {
while
(a_button()==1); . . .}
//debounce A button
is equivalent to
while
(a_button_clicked()==0) {. . .}
accel_x [Category: Sensors]
Format:
int
accel_x();
Returns the value of the accelerometer in its x direction relative to the horizontal plane of the
KIPR Link.
accel_y [Category: Sensors]
Format:
int
accel_y();
Returns the value of the accelerometer in its y direction relative to the horizontal plane of the
KIPR Link.
accel_z [Category: Sensors]
Format:
int
accel_z();
Returns the value of the accelerometer for its vertical, or z direction, relative to the horizontal
plane of the KIPR Link. When the Link is horizontal it is calibrated to have a value
corresponding to the gravitational constant G (your acceleration to towards the center of the
Earth to keep you from flying off of the planet).
alloff [Category: Motors]
Format:
void
alloff();
Turns off all motors.
ao
is a short form for
alloff
.
analog [Category: Sensors]
Format:
int
analog(
int
p);
Returns the value of the sensor installed at the port numbered
p
. The result is an integer
between 0 and 255. The function can be used with analog ports 0 through 7.
analog10 [Category: Sensors]
Format:
int
analog10(
int
p);
10-bit version of the analog function. The returned value is in the range 0 to 1023 rather than 0
to 255.
any_button [Category: Sensors]
Format:
int
any_button();
Returns 1 if any button is pressed (the Side button or any of the 6 soft buttons A,B,C,X,Y,Z).
ao [Category: Motors]
Format:
void
ao();
Turns off all motors.