Private
Public Access
2
0
Files
mraa/examples/javascript/isr.js
Kas Perch 075a7b1225 JS examples: refactor for clarity and consistent style
Signed-off-by: Kassandra Perch <the@nodebotani.st>
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-05-06 14:38:54 +02:00

19 lines
401 B
JavaScript

#!/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);