mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Neopixel for MCU Edition
This commit is contained in:
parent
f7f313c197
commit
5448a83920
@ -4,8 +4,17 @@
|
||||
<label for="node-input-pixels"><i class="fa fa-sun-o"></i> LEDs</label>
|
||||
<input type="text" id="node-input-pixels" placeholder="number" style="width:60px;"> in the string
|
||||
<span style="margin-left:50px;">Pin Number </span>
|
||||
<select id="node-input-gpio" style="width:50px; margin-left:5px;">
|
||||
<option value="18">12</option>
|
||||
<select id="node-input-gpio" style="width:200px; margin-left:5px;">
|
||||
<!--
|
||||
<option value="32">M5Stack Core2 PortA</option>
|
||||
<option value="26">M5Stack Core2 PortB</option>
|
||||
<option value="13">M5Stack Core2 PortC</option>
|
||||
-->
|
||||
<option value="25">M5Stack Core2 AWS</option>
|
||||
<option value="25">M5Stack Core2 Bottom2</option>
|
||||
<option value="15">M5Stack Fire</option>
|
||||
<option value="27">M5Atom Matrix</option>
|
||||
<option value="18">12</option>
|
||||
<option value="12">32</option>
|
||||
<option value="13">33</option>
|
||||
<option value="19">35</option>
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var spawn = require('child_process').spawn;
|
||||
// RED.log.warn("rpi-neopixels : This node is for MCU Edition. Do not run.");
|
||||
/**
|
||||
var spawn = require('child_process').spawn;
|
||||
var execSync = require('child_process').execSync;
|
||||
var fs = require('fs');
|
||||
var colors = require('./colours.js');
|
||||
@ -30,7 +32,7 @@ module.exports = function(RED) {
|
||||
|
||||
// the magic to make python print stuff immediately
|
||||
process.env.PYTHONUNBUFFERED = 1;
|
||||
|
||||
**/
|
||||
function PiNeopixelNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.pixels = n.pixels || 1;
|
||||
@ -117,7 +119,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
if (allOK === true) {
|
||||
node.child = spawn(piCommand, [node.pixels, node.wipe, node.mode, node.brightness, node.gamma, node.channel, node.gpio]);
|
||||
/**
|
||||
node.child = spawn(piCommand, [node.pixels, node.wipe, node.mode, node.brightness, node.gamma, node.channel, node.gpio]);
|
||||
node.status({fill:"green",shape:"dot",text:"ok"});
|
||||
|
||||
node.on("input", inputlistener);
|
||||
@ -169,10 +172,11 @@ module.exports = function(RED) {
|
||||
node.fgnd = colors.getRGB(node.fgnd,node.rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
**/
|
||||
}
|
||||
else {
|
||||
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
||||
}
|
||||
}
|
||||
RED.nodes.registerType("rpi-neopixels",PiNeopixelNode);
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
{
|
||||
"name" : "node-red-node-pi-neopixel",
|
||||
"version" : "2.0.1",
|
||||
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
|
||||
"dependencies" : {
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
"url":"https://github.com/node-red/node-red-nodes.git",
|
||||
"name": "node-red-contrib-node-pi-neopixel",
|
||||
"version": "2.0.1",
|
||||
"description": "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Node-RED MCU Edition.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/NextWorldLab/node-red-nodes",
|
||||
"directory": "tree/master/hardware/neopixel"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
@ -21,13 +19,7 @@
|
||||
"rpi-neopixels": "neopixel.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "scripts/checklib.js"
|
||||
},
|
||||
"author": {
|
||||
"name": "Dave Conway-Jones",
|
||||
"email": "ceejay@vnet.ibm.com",
|
||||
"url": "http://nodered.org"
|
||||
},
|
||||
"engines" : { "node" : ">=12.0.0" }
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var fs = require('fs');
|
||||
|
||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/unicornhat.py') && !fs.existsSync('/usr/local/lib/python3.9/dist-packages/unicornhat.py')) {
|
||||
console.warn("WARNING : Can't find required python library");
|
||||
console.warn("WARNING : Please install using the following command");
|
||||
console.warn("WARNING : Note: this uses root...");
|
||||
console.warn("WARNING : curl -sS get.pimoroni.com/unicornhat | bash\n");
|
||||
//process.exit(1);
|
||||
}
|
||||
else {
|
||||
console.log("Python library found OK.\n")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user