-
If I make setWatch twice or more, I get the function double or more, when I hit the button.
>setWatch(function() { : if(digitalRead(BTN1)) { : print("did"); : } else { : print("dad"); } :}, BTN1, {repeat:true,debounce:10}); =1 >setWatch(function() { : if(digitalRead(BTN1)) { : print("did"); : } else { : print("dad"); } :}, BTN1, {repeat:true,debounce:10}); =2 did did dad dad >
If I made it with this, I get a fault, because both pins, start with 1, but are different ports.
>setWatch(function() { : if(digitalRead(B1)) { : print("fif"); : } else { : print("faf"); } :}, B1, {repeat:true,debounce:10}); =3 >setWatch(function() { : if(digitalRead(B1)) { : print("eie"); : } else { : print("eae"); } :}, A1, {repeat:true,debounce:10}); WARNING: Unable to set watch on pin. You may already have a watch on a pin with the same number. =undefined >
If I chance that line I get the error if I made 2 with the same pin nr. in jswrap_io.c
from:if (!jsiIsWatchingPin(pin) && !jshCanWatch(pin)) {
to:
if (jsiIsWatchingPin(pin) && !jshCanWatch(pin)) {
But C is very difficult for me, so would it be possibly to check on the ports also?
It can wait to after the kickstarter is over.
It was on Espruino 1v72I am still chasing the fault on my stm32f3discovery.
I am a big kickstarter fan of you. -
-
-
-
-
-
-
-
-
-
-
Am I doing something wrong here.
//test_puls01 var thePin = LED1; var theDummy = LED2; /* // Both turn on at the same time, then LED2 off, and then LED1 off. digitalPulse(thePin,1,800); digitalPulse(theDummy,1,400); // This is normal. */ // First turn LED1 on, then LED2 on, and off almost simultaneously. digitalPulse(thePin,1,800); digitalPulse(thePin,0,0); digitalPulse(theDummy,1,400); // Something wrong here /* _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v66 Copyright 2014 G.Williams >echo(0); =undefined Uncaught [object Object] at line 1 col 26 digitalPulse(thePin,0,0); ^ > */
-
-
-
-
-
-
-
for(i=1,j=5.5;i<10;i++) {
... console.log("i=",i," j=",j,"Modulus j%i=",j%i);
... }In node.js:
i= 1 j= 5.5 Modulus j%i= 0.5
i= 2 j= 5.5 Modulus j%i= 1.5
i= 3 j= 5.5 Modulus j%i= 2.5
i= 4 j= 5.5 Modulus j%i= 1.5
i= 5 j= 5.5 Modulus j%i= 0.5
i= 6 j= 5.5 Modulus j%i= 5.5
i= 7 j= 5.5 Modulus j%i= 5.5
i= 8 j= 5.5 Modulus j%i= 5.5
i= 9 j= 5.5 Modulus j%i= 5.5In Espruino 1v61:
i= 1 j= 5.5 Modulus j%i= 0
i= 2 j= 5.5 Modulus j%i= 1
i= 3 j= 5.5 Modulus j%i= 2
i= 4 j= 5.5 Modulus j%i= 1
i= 5 j= 5.5 Modulus j%i= 0
i= 6 j= 5.5 Modulus j%i= 5
i= 7 j= 5.5 Modulus j%i= 5
i= 8 j= 5.5 Modulus j%i= 5
i= 9 j= 5.5 Modulus j%i= 5 -
-
-
-
-
Well now I success. I found the error in:
Espruino-master/targets/stm32/jshardware.c, downloaded today.
It say's espruino_1v72_stm32f3discovery.bin when compiled.
I have changed the following lines:
The fault is in section 3: it vent 1,2,4 and should be 0,1,2.
At the same time I removed JSH_PIN0, because it is 0, and something - 0 gives something. That saved me 24 bytes.
I don't know what it else have influence on.
I hope you can integrate it in the next version.
C is difficult I must say.