summaryrefslogtreecommitdiff
path: root/peripheral/libmraa/examples/javascript/isr.js
blob: 9abcb1fc2b8044dd0b41a2b8832961dc4a7bf47e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env node

var m = require('mraa')

function h() {
  console.log("HELLO!!!!")
}

x = new m.Gpio(14)
x.isr(m.EDGE_BOTH, h)

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)