You are reading a single comment by @MrTimcakes and its replies. Click here to read the full conversation.
  • Allow me to clear some things up with some examples.
    Espruino's version of interrupts are watches, watches can be set to happen when a pin rises (from low to high), falls (High to low) or both. Watches are set like this:

    function toggleLED(){
    digitalWrite(LED1, !digitalRead(LED1));
    }
    
    setWatch(toggleLED, BTN1, {repeat:true,edge:"rising", debounce:1/ms/});
    

    This watch executes the ToggleLED function every time button 1 is pressed, this watch also induces a debounce for the button.
    Because of Espruino's event driven nature the chip automatically sleeps while nothing is happening to reduce power usage, in Arduino you have to tell the chip to sleep in your program.
    Watches can be removed with the function clearWatch(), this function without any arguments deletes all watches currently set. However if when you create your watch you assign it a variable, e.g. Watch1 = setWatch(... , you can pass clearWatch that variable and only remove specific watches.

    Some more advanced information:
    High is at least 1.546v
    Low is below 1.166v

About

Avatar for MrTimcakes @MrTimcakes started