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
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
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