Private
Public Access
2
0

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>
This commit is contained in:
Kas Perch
2017-02-23 00:57:19 -06:00
committed by Alex Tereschenko
parent 43d9f6c400
commit 075a7b1225
12 changed files with 145 additions and 127 deletions

View File

@@ -1,16 +1,18 @@
#!/usr/bin/env node
var m = require('mraa')
"use strict";
function h() {
console.log("HELLO!!!!")
const mraa = require('mraa');
function hello() {
console.log("HELLO!!!!");
}
x = new m.Gpio(14)
x.isr(m.EDGE_BOTH, h)
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 " + x.getPin() + "...")
}, 10000)
console.log("Waiting for an interrupt at GPIO pin " + pin.getPin() + "...");
}, 10000);