0.2.0 • Published 3 years ago

cncjs-pendant-gpio v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

cncjs-pendant-gpio

Version Downloads/week License

Configurable gpio pendant for cncjs

Installation

npm install -g cncjs-pendant-gpio

Usage

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

Configuration

cncjs-pendant-gpio loads json configuration from ~/cncjs-pendant-gpio

Example

{
  "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
}

debounceTimeout

Default is 20 ms

port

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.

pin

Every pin is described as an object. Field type defines type of pin.

Available types

button

fielddescriptiondefault valuerequired
typeshould be "button""button"true
gpiogpio pin numbertrue
edge"rising", "falling", "both"true
actionsarray of actionstrue

action

Every action is described as an object. Field type defines type of action.

Available types

log

Log message to standard output

fielddescriptiondefault valuerequired
typeshould be "log""log"true
messagewhatever you want to see in logstrue

gcode

Send gcode to controller

fielddescriptiondefault valuerequired
typeshould be "gcode""gcode"true
gcodegcode commandtrue