Go to the source code of this file.
ENC03R sensor constructor
- Parameters
-
pin | Analog pin to use |
vref | Reference voltage to use; default is 5.0 V |
- Returns
- Device context
ENC03R destructor
- Parameters
-
Update the internal state with the current reading. This function must be called prior to calling enc03r_angular_velocity().
- Parameters
-
- Returns
- UPM result
upm_result_t enc03r_calibrate |
( |
const enc03r_context |
dev, |
|
|
unsigned int |
samples |
|
) |
| |
Calibrates the sensor by determining an analog reading over many samples with no movement of the sensor. This must be done before attempting to use the sensor.
- Parameters
-
dev | Device context |
samples | Number of samples to use for calibration |
- Returns
- UPM result
Returns the currently stored calibration value
- Parameters
-
- Returns
- Current calibration value
Return the computed Angular Velocity in degrees per second. You must have called encr03r_update() prior to calling this function.
- Parameters
-
- Returns
- Computed angular velocity
Set sensor offset. The offset is applied to the return value before scaling. Default is 0.
- Parameters
-
dev | Device context |
offset | Offset to apply to value |
Set sensor scale. The return value is scaled by this value after the offset is applied. Default is 1.0.
- Parameters
-
dev | Device context |
scale | Scale to apply to value |
Get a normalized ADC value from the sensor. The return value will be between 0.0 (indicating no voltage) and 1.0 indicating max voltage (aref). encr03r_update() must be called prior to calling this function.
- Parameters
-
- Returns
- The normalized reading from the ADC.