The backlight stuff was just tinkering about trying to make it "feel" right - i.e you hit the button and it comes on, stays on for a while after but if you hit it a few times it stays on until a while after the last press (hence varing the timeout).
The (function(){...})(); is just a closure, common in the web world (the background I come from, I'm new to electronics).
This wasn't by any means final code I was just worried I'd broken the board by putting 2.9V in to A5 - FWIW after getting the code to run on the board again, it still freaks out (crashes and I have to reload an empty environment) when I put 2.9V to A5 from the Lab PSU, so there's definitely something bad going on.
For now I've added another 10K resistor on the divr1 side (making divr1 ESR of 20K)... it seems to function fine with this, so there's definitely something about ~2.9V on that pin that's breaking things.
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.
The backlight stuff was just tinkering about trying to make it "feel" right - i.e you hit the button and it comes on, stays on for a while after but if you hit it a few times it stays on until a while after the last press (hence
var
ing the timeout).The
(function(){...})();
is just a closure, common in the web world (the background I come from, I'm new to electronics).This wasn't by any means final code I was just worried I'd broken the board by putting 2.9V in to A5 - FWIW after getting the code to run on the board again, it still freaks out (crashes and I have to reload an empty environment) when I put 2.9V to A5 from the Lab PSU, so there's definitely something bad going on.
For now I've added another 10K resistor on the
divr1
side (makingdivr1
ESR of 20K)... it seems to function fine with this, so there's definitely something about ~2.9V on that pin that's breaking things.