Treehopper C# API
IPollable Interface Reference

Represents any sensor or input that must be polled to retrieve an update More...

Inheritance diagram for IPollable:
NesController WiiClassicController IAdcPeripheral IPortExpanderParent IPolledEvents IAccelerometer IGyroscope Lsm303dlhc IProximity IMagnetometer IAmbientLightSensor Veml6070 ITemperatureSensor

Public Member Functions

Task UpdateAsync ()
 Requests a reading from the sensor and updates its data properties with the gathered values. More...
 

Properties

bool AutoUpdateWhenPropertyRead [get, set]
 Gets or sets whether reading from the sensor's properties should request updates from the sensor automatically (defaults to true). More...
 

Detailed Description

Represents any sensor or input that must be polled to retrieve an update

Member Function Documentation

◆ UpdateAsync()

Task UpdateAsync ( )

Requests a reading from the sensor and updates its data properties with the gathered values.

Returns
An awaitable Task

Note that when AutoUpdateWhenPropertyRead is true (which it is, by default), this method is implicitly called when any sensor data property is read from — there's no need to call this method unless you set AutoUpdateWhenPropertyRead to false.

Unless otherwise noted, this method updates all sensor data simultaneously, which can often lead to more efficient bus usage (as well as reducing USB chattiness).

Implemented in Bno055, Hmc5883l, Mpu6050, L3gd20, Bmp280, Tsl2591, Mcp23008, WiiClassicController, WiiNunchuk, Vcnl4010, Nau7802, Mpu9250, Bh1750, Bme280, Ds18b20, Ads1115, Adxl345, Lis3dh, TemperatureSensorBase, PortExpander, Veml6070, Tlv493d, Lsm303dlhc, ProximitySensor, PressureSensor, NesController, Lsm303dlhcMag, AccelerometerBase, GyroscopeBase, AmbientLightSensor, Mcp9700, MagnetometerBase, Lm75, Ak8975, Lsm303dlhcAccel, Mcp9808, and SuperNesController.

Property Documentation

◆ AutoUpdateWhenPropertyRead

bool AutoUpdateWhenPropertyRead
getset

Gets or sets whether reading from the sensor's properties should request updates from the sensor automatically (defaults to true).

By default, whenever you access one of the properties of this sensor, a new reading will be fetched. If this property is set to false, you must manually call the UpdateAsync() method to retrieve a new sensor reading.

This functionality enables more efficient sensor updates, since it allows you to intelligently control when data is gathered.


The documentation for this interface was generated from the following file: