UNPKG

mraa

Version:

IO library that helps you use I2c, SPI, gpio, uart, pwm, analog inputs (aio) and more on a number of platforms such as the Intel galileo, the Intel edison and others

19 lines (13 loc) 401 B
#!/usr/bin/env node "use strict"; const mraa = require('mraa'); function hello() { console.log("HELLO!!!!"); } let pin = new mraa.Gpio(14); pin.isr(mraa.EDGE_BOTH, hello); setInterval(function() { // It's important to refer to our GPIO context here, // otherwise it will be garbage-collected console.log("Waiting for an interrupt at GPIO pin " + pin.getPin() + "..."); }, 10000);