This's relay controller for Raspberry Pi
It can control open
,close
,toggle
,openAt
,closeAt
and toggleAt
- Install
gpio-admin
form https://github.com/quick2wire/quick2wire-gpio-admin - Install relay-controller
npm install relay-controller
relay.open(pin,[times],[callback])
- open relay
- times Time delay opening
- callback will return status
relay.close(pin,[times],[callback])
- close relay
- times Timing closure
- callback
relay.toggle(pin,[callback])
- toggle relay open or close
- callback will return relay status
relay.openAt(pin,times,[callback])
relay.closeAt(pin,times,[callback])
relay.toggleAt(pin,object,[callback])
- toggle relay open pr close timing
- object {time:1000,number:10}
- callback will return relay status
var relay = require("relay-controller").relay;
var pin = 21;
To open relay ...
relay.open(pin,function(status){
console.log(status);
})
Timing close
relay.closeAt(pin,1000,function(){
console.log("close...");
})
Or
relay.close(pin,1000,function(){
console.log("close...");
})