As @Robin points out, wiring the resistor in series and pinMode(B15,"af_opendrain") are contradictory not just in itself, but also from the point of driving an input...
Anyway, I'm glad you sorted things out.
Yes, LEDs - even though very efficient in turning electricity into light - they are very power hungry... just for your calculation:
1 single LED draws 20mA... 1 single RGB LED is three LEDs and on white - [255,255,255] - this is 60mA. Driving a few LEDs - when connected w/ IDE - works, but it is just for testing some logic. To go real, you really need to feed the string what it needs. Feeding them via 4 AA batteries and showing 5.3V tells me that the AA cells are already pretty stressed... For all your strips, look for a PC power supply and use its 5V to do what need ('google' something like 'DIY 5V power supply w/ PC'). Since such supplies deliver beyond what you need (for single strip), adding a fuse can never hurt... and with 60mA / RGB and number of RGBs you can calculate the required fuse rating... and add tens of percent for a regular (fast) fuse or less for a slow fuse.
NOTE: when developing - being connected to the IDE over USB - have Espruino's BatIn DISCONNECTED from you external 5V supply.
Looking forward to see code and pics of your project while it's coming along.
© Espruino, powered by microcosm.
Report a problem