How to write attachInterrupt in BoneScript in details.

Hi, forks!!

I have some questions about attachInterrupt.

I saw the topic
attachInterrupt contents called on startup and stop without event triggered!topic/beagleboard/bhacfUnNJYM

I think one of solution is check actual button has pushed or not.

b.attachInterrupt(inputPin, true, b.FALLING, interruptCallback);
function interruptCallback() {
if (b.digitalRead(inputPin)===1) return; // Is the real button pushed? or not?

But in this case, the function interruptCallback tightly depend on hardware ,so I can’t reuse it call from another functions (for example WEB interrupt logic).
It seems not good solution.

Is there any solution more smart?


I guess the result of handler can determine to interruptCallback execute or not.
But when my function myhandler always return true, interruptCallback never called…

b.attachInterrupt(inputPin, myhandler, b.FALLING, interruptCallback);

function myhandler(){
return true;

Could you tell me what is wrong, Please!


You could use in onoff in place of attachInterrrupt. See