read information from EV3 touch sensor
$ npm install touch-sensor
var TouchSensor = require('touch-sensor')
TouchSensor(3).value // => 0
port
- number of port where the touch sensor is connected
Returns: instance of TouchSensor
Get the value of the touch sensor.
Returns: either 0 or 1 to indicate the state of the touch sensor
value | state |
---|---|
0 | not pressed |
1 | pressed |
MIT