I am new to raspberry and nodejs, what I am trying to achieve is take a picture from webcam after pressing physical button and sending it to the server.
I have raspberry pi set up with node.js installed , after installing pi-gpio and all modules required(plus onoff module), first I got error about missing module (gpio), so i used linked module to my project directory and after running the node js script i got this error:
/var/www/node $ node button.js
/usr/local/lib/node_modules/rpi-gpio/rpi-gpio.js:355
if (cb) return cb(err);
^
TypeError: string is not a function
at /usr/local/lib/node_modules/rpi-gpio/rpi-gpio.js:355:24
at fs.js:949:21
at Object.oncomplete (fs.js:107:15)
Any help would be greatly appreciable
code for buttn.js
var gpio = require('rpi-gpio');
gpio.on('change', function(channel, value) {
console.log('Channel ' + channel + ' value is now ' + value);
});
gpio.setup(23, gpio.DIR_IN);