InPort library
Note Content
Library provides functionality for inputs (GPIO) reading. Initialize:
var InPort = require('inport');
var pins = ['GPIO11','GPIO12'];
var inport = new InPort(pins);
Read port value
getPort ();
Reads actual value of port.
Monitoring changes of port
When port value is changed, function portChanged(...) will be invoked. This function has to be defined in your code.
portChanged (value);
Number value - It is value of all pins in port.
Example - using InPort
var InPort = require('inport');
var sys = require('system');
var pins = ['GPIO11','GPIO12'];
var inport = new InPort(pins);
inport.portChanged = function(value){
sys.println("Port changed:"+value);
}
Release port
Releases an instance of a GPIO port of input pins. The pins of the port are closed as well and can be added to a new port.
release ();
function releases an instance of InPort and close assigned GPIOs.
Example release()
inport.release();