26#if defined(CONF_DSENSOR)
118 void mode(
bool makeActive)
const {
167 unsigned int sample(
unsigned int size = 10,
int wait = 2)
const {
168 if (size == 0) size = 1;
169 unsigned int sum(
get());
170 for (
unsigned int i = 1; i < size; ++i) {
185#warning Enable CONF_DSENSOR to use Sensor.H
Battery-sensor interface (RCX Internal).
void active() const
Set the sensor to active (provide voltage to connector)
volatile unsigned int & sensor
The address of our sensor value.
unsigned int get() const
Get the current sensor reading.
Port
List of sensor identifiers (IDs).
void mode(bool makeActive) const
Set the sensor (mode) to active or passive.
void strobe() const
Quickly turn sensor off then back on.
void strobe(const int ms) const
Turn sensor off, wait for {ms} milliSeconds, then then turn it back on.
Sensor(const Port port, bool makeActive=false)
Construct a new sensor instance.
void off() const
Turn the sensor off (turn off voltage to connector)
void passive() const
Set the sensor to passive (turn off voltage to connector)
void on() const
Turn the sensor on (provide voltage to connector)
~Sensor()
Destroy this sensor instance.
unsigned int sample(unsigned int size=10, int wait=2) const
Get the average of {size} samples, waiting {wait} mSec between each sample.
kernel configuration file
void delay(unsigned ms)
uncalibrated delay loop
Interface: console input / output.
#define SENSOR_2
Sensor on input pad 2.
void ds_passive(volatile unsigned *sensor)
set sensor mode to passive (light sensor detects ambient light)
void ds_active(volatile unsigned *sensor)
set sensor mode to active (light sensor emits light, rotation works)
#define BATTERY
Battery sensor.
#define SENSOR_1
< the raw sensors
#define SENSOR_3
Sensor on input pad 3.