2015-02-18 14:30:22 +00:00
|
|
|
#!/usr/bin/env node
|
2019-05-09 09:47:11 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*/
|
2015-02-18 14:30:22 +00:00
|
|
|
|
2017-02-23 00:57:19 -06:00
|
|
|
"use strict";
|
2015-02-18 14:30:22 +00:00
|
|
|
|
2017-02-23 00:57:19 -06:00
|
|
|
const mraa = require('mraa');
|
|
|
|
|
|
|
|
|
|
function hello() {
|
|
|
|
|
console.log("HELLO!!!!");
|
2015-02-18 14:30:22 +00:00
|
|
|
}
|
|
|
|
|
|
2017-02-23 00:57:19 -06:00
|
|
|
let pin = new mraa.Gpio(14);
|
|
|
|
|
pin.isr(mraa.EDGE_BOTH, hello);
|
2016-03-28 18:41:43 +02:00
|
|
|
|
|
|
|
|
setInterval(function() {
|
|
|
|
|
// It's important to refer to our GPIO context here,
|
|
|
|
|
// otherwise it will be garbage-collected
|
2017-02-23 00:57:19 -06:00
|
|
|
console.log("Waiting for an interrupt at GPIO pin " + pin.getPin() + "...");
|
|
|
|
|
}, 10000);
|