isr.js: updated JS ISR example to avoid GPIO context being destroyed
Closes #403. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
ecf049eccd
commit
00a0abd030
@@ -8,3 +8,9 @@ function h() {
|
|||||||
|
|
||||||
x = new m.Gpio(14)
|
x = new m.Gpio(14)
|
||||||
x.isr(m.EDGE_BOTH, h)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user