mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
update neo-pixel and unicorn hat nodes to use later libs
This commit is contained in:
parent
ee852bf060
commit
39fd3b85cd
@ -3,7 +3,11 @@
|
|||||||
# Import library functions we need
|
# Import library functions we need
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from neopixel import *
|
try:
|
||||||
|
from rpi_ws281x import __version__, PixelStrip, Adafruit_NeoPixel, Color
|
||||||
|
except ImportError:
|
||||||
|
from neopixel import Adafruit_NeoPixel as PixelStrip, Color
|
||||||
|
__version__ = "legacy"
|
||||||
|
|
||||||
# LED strip configuration:
|
# LED strip configuration:
|
||||||
LED_COUNT = 8 # Number of LED pixels.
|
LED_COUNT = 8 # Number of LED pixels.
|
||||||
|
@ -15,7 +15,7 @@ module.exports = function(RED) {
|
|||||||
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
|
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel.py')) {
|
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel/')) {
|
||||||
RED.log.warn("Can't find neopixel.py python library");
|
RED.log.warn("Can't find neopixel.py python library");
|
||||||
throw "Warning : Can't find neopixel.py python library";
|
throw "Warning : Can't find neopixel.py python library";
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pi-neopixel",
|
"name" : "node-red-node-pi-neopixel",
|
||||||
"version" : "0.0.14",
|
"version" : "0.0.15",
|
||||||
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
|
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel.py')) {
|
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel/')) {
|
||||||
console.warn("WARNING : Can't find neopixel.py python library");
|
console.warn("WARNING : Can't find neopixel.py python library");
|
||||||
console.warn("WARNING : Please install using the following command");
|
console.warn("WARNING : Please install using the following command");
|
||||||
console.warn("WARNING : Note: this uses root...");
|
console.warn("WARNING : Note: this uses root...");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pi-unicorn-hat",
|
"name" : "node-red-node-pi-unicorn-hat",
|
||||||
"version" : "0.0.14",
|
"version" : "0.0.15",
|
||||||
"description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.",
|
"description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"pngjs": "2.2.*"
|
"pngjs": "2.2.*"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/unicornhat.py')) {
|
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel')) {
|
||||||
console.warn("WARNING : Can't find unicorn.py python library");
|
console.warn("WARNING : Can't find unicorn.py python library");
|
||||||
console.warn("WARNING : Please install using the following command");
|
console.warn("WARNING : Please install using the following command");
|
||||||
console.warn("WARNING : Note: this uses root...");
|
console.warn("WARNING : Note: this uses root...");
|
||||||
|
@ -12,7 +12,7 @@ module.exports = function(RED) {
|
|||||||
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
|
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/unicornhat.py')) {
|
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel')) {
|
||||||
RED.log.warn("Can't find Unicorn HAT python libraries");
|
RED.log.warn("Can't find Unicorn HAT python libraries");
|
||||||
throw "Warning : Can't find Unicorn HAT python libraries";
|
throw "Warning : Can't find Unicorn HAT python libraries";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user