Sensors
#include <dsensor.h>
light sensors may be put into active mode if desired (probably)
rotation sensors must be in active mode for proper readings
rotation sensors must also be activated with ds_rotation_on
touch sensors must be in passive mode for proper readings
These constants are defined:
- LIGHT_RAW_BLACK
- LIGHT_RAW_WHITE
- LIGHT_MAX
-
DS_ALL_ACTIVE
-
a macro to set all sensors as active
-
DS_ALL_PASSIVE
-
a macro to set all sensors as passive
-
void
ds_active
( SENSOR );
-
-
void
ds_passive
( SENSOR );
-
set an individual sensor mode
Parameters: |
SENSOR
-
must be one of the following
- &SENSOR_1
- &SENSOR_2
- &SENSOR_3
|
-
void
ds_rotation_on
( SENSOR );
-
-
void
ds_rotation_off
( SENSOR );
-
sets a sensor into rotation sensor mode
Parameters: |
SENSOR
-
must be one of the following
- &SENSOR_1
- &SENSOR_2
- &SENSOR_3
|
returns:
-
void
ds_rotation_set
( SENSOR, int i );
-
sets the value of a rotation sensor. Use this to initialize and calibrate
your rotation sensors when your program begins.
Parameters: |
SENSOR - see above
-
i
The value to set the rotation sensor to
|
returns:
-
int
TOUCH_X
-
macro for touch sensor X. evaluates to zero if touch sensor connected to input
port X is released, and
non-zero if the touch sensor is pressed.
-
int
LIGHT_X
-
macro for light sensor X. evaluates to an integer between LIGHT_MIN and LIGHT_MAX
-
int
ROTATION_X
-
macro for rotation sensor X. evaluates to how many 16ths of a revolution the
rotation sensor has spun.
-
int
SENSOR_X
-
macro for sensor X. evaluates to the raw, unprocessed value returned by the
sensor connected to input port X.
-
int
get_battery_mv
( );
-
returns: the battery voltage, in millivolts
-
int
BATTERY
-
macro for the raw battery voltage level. use
get_battery_mv
instead