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 analog-sensor
node.
↓ Download as a Fritzing project
Let’s make a smart (or dumb) light bulb.
Assemble the circuit with an LDR and LED.
Link the VAL
output pin of the analog-sensor
node to the LUM
pin of the led
node.
Upload the patch to the board.
Cover the photoresistor with your hand and watch how the brightness of the LED changes.