|
muwerk mupplet Sensor Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications for sensors
|
mupplet-sensor analog LDR illumance sensor More...
#include <mup_illuminance_ldr.h>
Public Member Functions | |
| IlluminanceLdr (String name, uint8_t port, FilterMode filterMode=FilterMode::MEDIUM) | |
| double | getUnitIlluminance () |
| void | begin (Scheduler *_pSched, uint32_t _pollRateMs=2000) |
mupplet-sensor analog LDR illumance sensor
The illuminance_ldr mupplet measures illuminance using a simple analog LDR (light dependent resistor)
| topic | message body | comment |
|---|---|---|
<mupplet-name>/sensor/unitilluminance | normalized illuminance [0.0-1.0] | Float value encoded as string |
<mupplet-name>/sensor/mode | FAST, MEDIUM, or LONGTERM | Integration time for illuminance values |
| topic | message body | comment |
|---|---|---|
<mupplet-name>/sensor/unitilluminance/get | - | Causes current value to be sent with. |
<mupplet-name>/sensor/mode/get | - | Returns filterMode: FAST, MEDIUM, or LONGTERM |
<mupplet-name>/sensor/mode/set | FAST, MEDIUM, or LONGTERM | Set integration time for illuminance values |
Hardware: LDR, 10kΩ resistor
Note: For ESP32 make sure to use a port connected to ADC #1, since ADC #2 conflicts with Wifi and ports connected to ADC #2 cannot be used concurrently with Wifi!
|
inline |
Instantiate an LDR sensor mupplet
| name | Name used for pub/sub messages |
| port | GPIO port with A/D converter capabilities. |
| filterMode | FAST, MEDIUM or LONGTERM filtering of sensor values |
|
inline |
Start processing of A/D input from LDR
|
inline |
Get current unit illumance