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:
committed by
Alex Tereschenko
parent
43d9f6c400
commit
075a7b1225
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user