Hardware Reference
In-Depth Information
console
.
log
(
'x.err = '
+
x
.
err
);
return
;
}
b
.
attachInterrupt
(
button
,
true
,
b
.
CHANGE
,
flashLED
);
}
b
.
pinMode
(
LED
,
b
.
OUTPUT
);
function
flashLED
(
x
) {
if
(
x
.
attached
) {
console
.
log
(
"Interrupt handler attached"
);
return
;
}
console
.
log
(
'x.value = '
+
x
.
value
);
console
.
log
(
'x.err = '
+
x
.
err
);
b
.
digitalWrite
(
LED
,
x
.
value
);
}
Add the code to a file named
pushLED.js
and run it by using the following commands:
bone#
chmod +x pushLED.js
bone#
./pushLED.js
Press ^C (Ctrl-C) to stop the code.