Did you try all this with a version you compiled yourself from Git?
As I said at the start, it turns out that the current version 1v47 has a bug where it reports the used memory incorrectly.
When I try your function in a newer version it reports 26 memory units (=520 bytes) for Blinker.
However: Looking at what's in Blinker, what happens is a new version of start and stop are created each time you instantiate it. If you put start and stop into Blinker.prototypeI think memory usage would be a lot better when blinking multiple LEDs.
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.
Did you try all this with a version you compiled yourself from Git?
As I said at the start, it turns out that the current version 1v47 has a bug where it reports the used memory incorrectly.
When I try your function in a newer version it reports 26 memory units (=520 bytes) for Blinker.
However: Looking at what's in Blinker, what happens is a new version of
start
andstop
are created each time you instantiate it. If you putstart
andstop
intoBlinker.prototype
I think memory usage would be a lot better when blinking multiple LEDs.