Now that we know our light sensor works, we can add an LED and create our night-light.
Creating our night-light
Wiring up the LED
Connect the short leg of your LED to a ground rail using a 330K ohm resistor, and wire the long leg to GPIO #5, also known as P1-29:
Coding this project
Create a file in the same folder as the other files from this chapter, and copy the contents of print-light-sensor-readings.js into it.
In the start of the board.on('ready') handler, add a constructor for our LED:
let light = new five.Led('P1-29')
And in the lightSensor...