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?
-
npmjs.com/package/node-pythonAloha– Aloha2015年12月22日 13:27:45 +00:00Commented Dec 22, 2015 at 13:27
1 Answer 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
-
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– agupta2312015年12月23日 06:56:53 +00:00Commented 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– joan2015年12月23日 09:38:52 +00:00Commented Dec 23, 2015 at 9:38