did you save() the code for running it? - if yes, remove the onInit(); invocation in line 104.
Then you have a lot of console log statements... these may put data into the serial out buffer... remove them or run them conditioned only when developing / testing and you are connected.
You have 300 neopixels - assuming the 300 from your var rgb = new Uint8ClampedArray(300*3); declaration. Each of them has a chip on it that controls the RGB leds and conditions the signal on write... Even if the LEDs are off, each of these chips draws about 1mA. So your 300 LEDs strip draws 300 mA even in off state... and that empties your AA quite quickly...
var rgb = new Uint8ClampedArray(300*3);
You may get some bistable relay that need only a pulse to toggle between on and off (or in one or the other direction to turn on and off).
Furthermore: Your pull downs consume some power as well... not much, since they are weak - 30..50k. Compared though to the 300mA as discussed before, it does not really make a difference. When you then though go for switching all off, you may rethink that and use even weaker (external) pull-ups.
© Espruino, powered by microcosm.
Report a problem