Skip to content

Commit

Permalink
isr.js: updated JS ISR example to avoid GPIO context being destroyed
Browse files Browse the repository at this point in the history
Closes eclipse#403.

Signed-off-by: Alex Tereschenko <[email protected]>
Signed-off-by: Brendan Le Foll <[email protected]>
  • Loading branch information
alext-mkrs authored and arfoll committed Apr 11, 2016
1 parent ecf049e commit 00a0abd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/javascript/isr.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ function h() {

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)

0 comments on commit 00a0abd

Please sign in to comment.