light-sensor

wayland/wio-terminal-sensors/light-sensor

Wio Terminal's built-in light sensor.
light-sensor
@/light-sensor
Wio Terminal's built-in light sensor.
UPDpulse
Triggers new read
light-sensor
VAL
DONE
UPD
DONEpulse
Fires on reading complete
VALnumber
The latest read value in range 0.0 … 1.0
To use the node in your project you should have the wayland/wio-terminal-sensors library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_UPD

node {
    void evaluate(Context ctx) {
         if (!isInputDirty<input_UPD>(ctx))
            return;

        ::pinMode(WIO_LIGHT, INPUT);
        emitValue<output_VAL>(ctx, ::analogRead(WIO_LIGHT) / 1023.);
        emitValue<output_DONE>(ctx, 1);
    }
}