Configurable gpio pendant for cncjs
npm install -g cncjs-pendant-gpio
cncjs-pendant-gpio [PORT]
PORT
- port of your controller. If not specified then pendant connect to first opened port. For more information please read this
cncjs-pendant-gpio loads json configuration from ~/cncjs-pendant-gpio
{
"pins": [{
"type": "button",
"gpio": 4,
"edge": "rising",
"actions": [{
"type": "log",
"message": "STOP"
},{
"type": "gcode",
"gcode": "!"
}]
},{
"type": "button",
"gpio": 3,
"edge": "rising",
"actions": [{
"type": "gcode",
"gcode": "$H"
}]
}],
"debounceTimeout": 20
}
Default is 20 ms
If not specified then pendant tracks ports and connect to first opened (you probably already did it in cncjs app). If you have only one controller connected it's probably enough for you. In case of multiple controllers you can use this field to select port witch should be used. You can also specify that in command.
Every pin is described as an object. Field type
defines type of pin.
field | description | default value | required |
---|---|---|---|
type | should be "button" |
"button" |
true |
gpio | gpio pin number | true |
|
edge | "rising" , "falling" , "both" |
true |
|
actions | array of actions | true |
Every action is described as an object. Field type
defines type of action.
Log message to standard output
field | description | default value | required |
---|---|---|---|
type | should be "log" |
"log" |
true |
message | whatever you want to see in logs | true |
Send gcode to controller
field | description | default value | required |
---|---|---|---|
type | should be "gcode" |
"gcode" |
true |
gcode | gcode command | true |