Let’s introduce a new sensor to measure the ambient light level. A photoresistor (aka light dependent resistor or LDR) will do a great job of measuring the parameter. However, there is a small problem: we do not have a photoresistor node in XOD.
We have basic nodes for working with digital and analog ports though. The photoresistor is a pretty primitive device, and all we need to do is read its value from the analog port. To do so, use an
Let’s make a smart (or dumb) light bulb.
Assemble the circuit with an LDR and LED.
VAL output pin of the
analog-sensor node to the
LUM pin of the
Upload the patch to the board.
Cover the photoresistor with your hand and watch how the brightness of the LED changes.