#include <Rain40x16.h>
Definition at line 12 of file Rain40x16.h.
◆ Rain40x16()
aruna::sensor::Rain40x16::Rain40x16 |
( |
driver::ADC * |
adc | ) |
|
Rainlevel sensor 40mmx16mm DC3-5V Currently hardcoded for 3.3V.
- Parameters
-
adc | ADC to use for conversion |
Definition at line 8 of file Rain40x16.cpp.
◆ get_water_level()
aruna::err_t aruna::sensor::Rain40x16::get_water_level |
( |
uint16_t & |
water_level_in_mm | ) |
|
|
overridevirtual |
Get water level in millimeters of the sensor.
- Parameters
-
water_level_in_mm | buffer to store water level in |
- Returns
- err_t::OK if water level could be retrieved
Implements aruna::sensor::Water.
Definition at line 12 of file Rain40x16.cpp.
int16_t voltage_to_mm(uint16_t mV)
err_t read_voltage(T &mV)
Read voltage level of input.
◆ voltage_to_mm()
int16_t aruna::sensor::Rain40x16::voltage_to_mm |
( |
uint16_t |
mV | ) |
|
|
private |
Definition at line 20 of file Rain40x16.cpp.
22 const int16_t sensor_length_mm = 40;
23 const int16_t max_voltage_when_dry = 20;
24 const int16_t voltage_at_min = 1000;
25 const int16_t voltage_at_max = 3300;
27 const int16_t voltage_diff = voltage_at_max - voltage_at_min;
29 if (mV < max_voltage_when_dry)
31 if (mV < voltage_at_min) {
36 return ceilf(((
float) mV - (
float) voltage_at_min) * ((
float) sensor_length_mm / (
float) voltage_diff));
◆ adc
The documentation for this class was generated from the following files: