Sunday, 12 March 2017

gpio on raspi and nodejs with rpi-gpio

Im running raspi Model B Rev 2 512MB, I installed the module and succesfully opened a pin for writing on it. Succesfully made a LED blink. Then I try to open a port for reading and I get and error

{ Error: EINVAL: invalid argument, write errno: -22, code: 'EINVAL', syscall: 'write' }

This the relevant part of the code.

var gpio = require('rpi-gpio');
server.listen(8080, function() {
    console.log('Servidor corriendo en http://localhost:8080');

    gpio.setup(7, gpio.DIR_OUT, control);
    gpio.setup(6, gpio.DIR_IN, control);
});

function control(err)
{
    if(err)
        console.log("Control function: " + err);
    else
        console.log('ok');
}

Any clue ??



via javirs

No comments:

Post a Comment