0

I am trying to make a led strip be run by my Pi, and with that, have a web output as well. I'm currently using this guide in order to control the LEDs (I know an arduino would be ideal, but I'm trying to make my project small). The problem is, I need to use the pigpio library, but it seems to be available only on python.

As mentioned beforehand, I want to have a web interface, preferably in javascript, to minimize page loading, and just to make it look nicer (just press a button, and the gpio pins get updated without the page reloading). Is there anyway to use this library with Node, or use python with Node, or am I stuck with PHP and python?

1

1 Answer 1

1

If you do a search through the node.js packages for pigpio you get the following results.

I don't know anything about node.js so can't comment on the usability of the packages.

npm search pigpio
NAME         DESCRIPTION                                                  AUTHOR   DATE       VERSION KEYWORDS                            
pi-fast-gpio Super fast GPIO access on the Raspberry Pi using the pigpio… =tobbe   2014-12-07 0.1.0   pigpio servo pwm hardware pwm raspbe
pigpio       Fast GPIO, PWM and servo control on the Raspberry Pi with…   =fivdi   2015-12-05 0.1.3   gpio pwm servo interrupt raspberry p
pigpio.js    A node.js library for the pigpio daemon, allowing fast,…     =jedahan 2014-06-07 0.0.3 

An alernative might be to run the pigpio daemon and then use its socket or pipe interface.

The pipe interface is the simplest if your program is running locally. To use PWM it is as simple as writing to a file (/dev/pigpio). E.g. to start PWM on GPIO 4 at 50% dutycycle write "p 4 128\n" to /dev/pigpio. The newline character (\n) is needed, as commands will be buffered until a newline is given.

dick ~ $ echo "p 4 128\n" >/dev/pigpio
dick ~ $ echo "p 5 32\n" >/dev/pigpio
2
  • I think the pipe interface looks awesome, the whole program will be run on a single pi, and although not ideal, I think this will get the job done.
    – agupta231
    Dec 23, 2015 at 6:56
  • See abyz.co.uk/rpi/pigpio/pigs.html for pipe/socket commands. Please be aware that the pipe i/f returns status.
    – joan
    Dec 23, 2015 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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