mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Let gpiod turn off output in servo mode by sending null or ""
to close #543
This commit is contained in:
parent
af4eefa5fb
commit
b74aacd266
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-pi-gpiod",
|
"name": "node-red-node-pi-gpiod",
|
||||||
"version": "0.0.11",
|
"version": "0.0.12",
|
||||||
"description": "A node-red node for PiGPIOd",
|
"description": "A node-red node for PiGPIOd",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"js-pigpio": "*"
|
"js-pigpio": "*"
|
||||||
|
@ -427,6 +427,7 @@
|
|||||||
and will set the selected physical pin high or low depending on the value passed in.</p>
|
and will set the selected physical pin high or low depending on the value passed in.</p>
|
||||||
<p>The initial value of the pin at deploy time can also be set to 0 or 1.</p>
|
<p>The initial value of the pin at deploy time can also be set to 0 or 1.</p>
|
||||||
<p>When using PWM and Servo modes, the input value should be a number 0 - 100, and can be floating point.</p>
|
<p>When using PWM and Servo modes, the input value should be a number 0 - 100, and can be floating point.</p>
|
||||||
|
<p>In Servo mode you can stop the output by sending a <code>msg.payload</code> of <code>null</code> or <code>""</code>.</p>
|
||||||
<p>If using with Docker on Pi then the default Host IP should be <code>172.17.0.1</code>. You will also need to run <code>sudo pigpiod</code> on the host.</p>
|
<p>If using with Docker on Pi then the default Host IP should be <code>172.17.0.1</code>. You will also need to run <code>sudo pigpiod</code> on the host.</p>
|
||||||
<p><b>Note</b>: the pin numbers refer the physical pin numbers on connector P1 as they are easier to locate.</p>
|
<p><b>Note</b>: the pin numbers refer the physical pin numbers on connector P1 as they are easier to locate.</p>
|
||||||
</script>
|
</script>
|
||||||
|
@ -99,6 +99,14 @@ module.exports = function(RED) {
|
|||||||
var PiGPIO;
|
var PiGPIO;
|
||||||
|
|
||||||
function inputlistener(msg) {
|
function inputlistener(msg) {
|
||||||
|
if (node.out === "ser" && (msg.payload === null || msg.payload === "")) {
|
||||||
|
if (!inerror) {
|
||||||
|
PiGPIO.setServoPulsewidth(node.pin, 0);
|
||||||
|
node.status({fill:"green",shape:"dot",text:""});
|
||||||
|
}
|
||||||
|
else { node.status({fill:"grey",shape:"ring",text:"N/C: " + msg.payload.toString()}); }
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (msg.payload === "true") { msg.payload = true; }
|
if (msg.payload === "true") { msg.payload = true; }
|
||||||
if (msg.payload === "false") { msg.payload = false; }
|
if (msg.payload === "false") { msg.payload = false; }
|
||||||
var out = Number(msg.payload);
|
var out = Number(msg.payload);
|
||||||
@ -126,6 +134,7 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
else { node.warn(RED._("pi-gpiod:errors.invalidinput")+": "+out); }
|
else { node.warn(RED._("pi-gpiod:errors.invalidinput")+": "+out); }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (node.pin !== undefined) {
|
if (node.pin !== undefined) {
|
||||||
PiGPIO = new Pigpio();
|
PiGPIO = new Pigpio();
|
||||||
|
Loading…
Reference in New Issue
Block a user