var led = require('@amperka/led') .connect(P1); var pot = require('@amperka/pot') .connect(A0); var sensor = require('@amperka/light-sensor') .connect(A2); setInterval(function() { var threshold = pot.read() * 100; var luxes = sensor.read('lx'); if (luxes < threshold) { led.turnOn(); } else { led.turnOff(); } }, 10);