gpio-c.h.i.p
v0.1.0
Published
Simple libray for C.H.I.P $9 Dollars
Downloads
5
Maintainers
Readme
GPIO-C.H.I.P
How to use
var GPIO = require('gpio-c.h.i.p');
GPIO.exportAll();
GPIO.unexportAll();
If you don´t export, is exported automatically.
Use GPIO.export(gpio_port)
GPIO.export(4);
Use GPIO.unexport(gpio_port)
GPIO.unexport(4);
Use GPIO.read(gpio_port)
var value = GPIO.read(0);
console.log(value);
Use GPIO.write(gpio_port, state, direction)
GPIO.write(4, 1, GPIO.IN | GPIO.OUT);
Use GPIO.direction(gpio_port, direction)
GPIO.direction(4, GPIO.IN | GPIO.OUT);
Use GPIO.isExported()
if(GPIO.isExported(4)){
console.log("Yes");
}
Use GPIO.isChip()
if(GPIO.isChip()){
console.log("I´m better than RPI");
}
Objects new GPIO.Gpio(gpio_port, direction)
var led = new Gpio(4, GPIO.OUT);
led.off(); // Value = 0;
led.on(); // Value = 1;
if(led.read() == 0){
led.on();
}