Node.js package for driving th
powerswitch
Node.js package for driving the Adafruit PowerSwitch Tail II. Originally built for use with Raspberry Pi, but theoretically it could work for other systems.
Installation$ npm install powerswitch --save
Usage
var ps = require('powerswitch');
var GPIO_PIN = 18; // Pin that the PowerSwitch Tail is wired to. Use Raspberry Pi addressing scheme for the pin (NOT SoC/BCM pin schemas)
// Instantiate a PowerSwitch object
var powerswitch = new ps(GPIO_PIN);
// Do some stuff with the switch
powerswitch.setOn();
console.log('The PowerSwitch is ', powerswitch.isOn ? 'ON' : 'OFF');
powerswitch.setOff();
// Remember to free up the GPIO pin when done!
powerswitch.destroy();
Release History
1.0.0 Initial release
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。