mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
4becf68848
commit
d26cb057f9
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-pi-gpiod",
|
"name": "node-red-node-pi-gpiod",
|
||||||
"version": "0.0.13",
|
"version": "0.1.0",
|
||||||
"description": "A node-red node for PiGPIOd",
|
"description": "A node-red node for PiGPIOd",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"js-pigpio": "*"
|
"js-pigpio": "*"
|
||||||
|
@ -46,13 +46,13 @@ module.exports = function(RED) {
|
|||||||
PiGPIO.set_glitch_filter(node.pin,node.debounce);
|
PiGPIO.set_glitch_filter(node.pin,node.debounce);
|
||||||
node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"});
|
node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"});
|
||||||
node.cb = PiGPIO.callback(node.pin, PiGPIO.EITHER_EDGE, function(gpio, level, tick) {
|
node.cb = PiGPIO.callback(node.pin, PiGPIO.EITHER_EDGE, function(gpio, level, tick) {
|
||||||
node.send({ topic:"pi/"+node.pio, payload:Number(level) });
|
node.send({ topic:"pi/"+node.pio, payload:Number(level), host:node.host });
|
||||||
node.status({fill:"green",shape:"dot",text:level});
|
node.status({fill:"green",shape:"dot",text:level});
|
||||||
});
|
});
|
||||||
if (node.read) {
|
if (node.read) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
PiGPIO.read(node.pin, function(err, level) {
|
PiGPIO.read(node.pin, function(err, level) {
|
||||||
node.send({ topic:"pi/"+node.pio, payload:Number(level) });
|
node.send({ topic:"pi/"+node.pio, payload:Number(level), host:node.host });
|
||||||
node.status({fill:"green",shape:"dot",text:level});
|
node.status({fill:"green",shape:"dot",text:level});
|
||||||
});
|
});
|
||||||
}, 20);
|
}, 20);
|
||||||
|
Loading…
Reference in New Issue
Block a user