function flash_led1(led_on) {
digitalWrite(LED1, led_on);
}
function pulse_led2() {
digitalPulse(LED2, 1, 150);
}
// when button is pressed
setWatch(function(e) {
console.log("Press at "+e.time);
digitalWrite(LED2, 0);
flash_led1(1);
}, BTN, {repeat: true, edge: "rising", debounce: 50});
// when button is pressed
setWatch(function(e) {
console.log("Release at "+e.time);
flash_led1(0);
pulse_led2();
}, BTN, {repeat: true, edge: "falling", debounce: 50});
Errors:
Press at
Uncaught Error: Field or method "time" does not already exist, and can't create it on undefined
at line 2 col 28
console.log("Press at "+e.time);
^
in function called from system
Release at
Uncaught Error: Field or method "time" does not already exist, and can't create it on undefined
at line 2 col 30
console.log("Release at "+e.time);
^
in function called from system
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.
I just try to flash this one:
http://www.espruino.com/binaries/git/commits/a11edb58f9300cf95742ac0611cbabe9ad67ed4c/espruino_1v80_pico_1r3_wiznet.bin
everything worked on flashing progress.
But now my demo-code brings some errors:
Errors: