Go to the documentation of this file.
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) {
184 #else // CONF_DSENSOR
185 #warning Enable CONF_DSENSOR to use Sensor.H
186 #endif // CONF_DSENSOR
Interface: console input / output.
void ds_passive(volatile unsigned *sensor)
set sensor mode to passive (light sensor detects ambient light)
void mode(bool makeActive) const
Set the sensor (mode) to active or passive.
volatile unsigned int & sensor
The address of our sensor value.
void active() const
Set the sensor to active (provide voltage to connector)
#define SENSOR_2
Sensor on input pad 2.
void on() const
Turn the sensor on (provide voltage to connector)
void strobe(const int ms) const
Turn sensor off, wait for {ms} milliSeconds, then then turn it back on.
#define SENSOR_3
Sensor on input pad 3.
void off() const
Turn the sensor off (turn off voltage to connector)
Sensor(const Port port, bool makeActive=false)
Construct a new sensor instance.
#define SENSOR_1
< the raw sensors
~Sensor()
Destroy this sensor instance.
void ds_active(volatile unsigned *sensor)
set sensor mode to active (light sensor emits light, rotation works)
void delay(unsigned ms)
uncalibrated delay loop
void passive() const
Set the sensor to passive (turn off voltage to connector)
void strobe() const
Quickly turn sensor off then back on.
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
unsigned int get() const
Get the current sensor reading.
Port
List of sensor identifiers (IDs).
#define BATTERY
Battery sensor.
Generated for brickOS Kernel Developer by
1.8.16