-
Fri 2019.08.09
Thank you for the detail Peter. That gets us all on the same page.
'Maybe too much memory used'
Have you tried to see if there are in fact memory leaks? Before first execution and just after upload, what is the result of
process.memory()
? Please post. Then run the code. Perform the test again and post that result. Do several more times to see if the total memory count goes down. My guess is no.Could you please check what the pinMode() is being assigned on each button tied to a pin.
getPinMode()
, . . . and/or, . . . is an external pull-up/pull-down resistor attached to each button? A schematic would assist here.Please post the snippet on how the setWatch() functions are set up and how are they first fired. Is this being done on the Right-Hand editor side of the WebIDE or the console Left-Hand side?
'I've added 8 lines with a "setWatch" at the end'
Have your tried eight individual button setWatch() functions, or is that the 'unstable' you are referring to in #5?
Fr #6 'maybe an issue with analog A8/A9/A10 pins.'
Is the pinMode() being set to 'analog'? You may be on to something here as setWatch() uses debounce for detection. The PWM (if being used that way) input may not have a detectable edge, similarly to a digital input. It is possible that analog input may work. I am not able to provide a definitive answer.
http://www.espruino.com/Reference#l__global_pinMode
http://www.espruino.com/Reference#t_l__global_setWatch'the debounce is on 1000 for all pins'
Try a value around 25-50. I'm not sure if that is a duration in msec or the number of detectable edges. It is likely that if 1000 is in msec, that is a full second and maybe out of the bounds of what you are attempting to track. If it is actual edge transitions, 1000 total may never be seen. See setWatch() link above.
Ok, I've changed the wiring on the pins to C4, C5, ... C11.
and also changed the setWatch to "Rising". and the common wire on the buttons to "bat".
the debounce is on 1000 for all pins.
it looks a little bit better, bu still not stable.
when I press C4 and C5, some other functions are called as well.
Maybe are C4 and C5 not the correct pins?