1

I create an app that must detect when the lights(LEDs) changes their status (on->off or off->on) monitor this to a site.I create this app in client side with node.js and use rpi.GPIO package from here.
But I can't use change event in this package here is my code:

var gpio = require('rpi-gpio');
function alert()
{
    console.log("detected !");
}

gpio.on('change', function(channel, value)
{
    //send monitoring data to server for monitor on site
});
gpio.setup(7, gpio.DIR_IN, alert);

change event never called !! even if I change the state of LED. is there any way to do this without use setInterval ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.