I want to use node.js to parse data from a java script application back to the node.js server, I have accomplished this in a very rudimentary form and now I want to have the data turn on or off the GPIO pins on the Pi B+. I attempted doing that with this module: https://www.npmjs.com/package/pi-gpio a problem I ran into is that apparently it's file path is outdated and there isn't really any easy way around it. I was wondering if anyone knew of an ulterior way of interfacing with the GPIO pins in Node.js.

  • If all else fails you could use syscalls to the Python gpio package. It wouldn't be fast but it would always work
    – benathon
    Apr 11 '15 at 10:45

I suggest using this module to switch and read GPIO pins, it is easy to handle and works very well: https://www.npmjs.com/package/onoff

Another module: https://www.npmjs.com/package/rpio

  • I find this module rather slow compared to the Python plugin and it is hard to configure pull-up / -down resistors that one looks good: npmjs.com/package/rpio
    – Thor_Bux
    Feb 6 '18 at 6:59
  • i did not know that one, will include it, thanx!
    – andyrandy
    Feb 6 '18 at 8:13

Use this module: https://www.npmjs.com/package/node-cmd

And use the gpio shell commands.

Run gpio -h on raspberry pi terminal to find syntax.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.