Most popular high powered LED flashlights have mode selection by “half pressing” the main power button. I am trying to accomplish this. I’ve designed a circuit using a ATTiny85 ( I can change this if there is something better suited), to control an LED driver. The driver works, just need help with the firmware. I’d attach a schematic, but simple and there’s just a few components to it, the micro, a capacitor and pull up resistor for the “mode selection” pin.
My question is that I can’t seem to get this design to change modes, it only powers off and then back on again. Can anyone provide some sample code of a typical mode changing flashlight so I can see how this works?
I’ve attached what I’m using thus far. I am guessing that the “Half press” is simply something that micro detects as temporary voltage drop within a short time period as a capacitor discharges? It would be nice to not use a giant capacitor and have the micro detect the on/off action as the button press itself. Any ideas?
flashlight attiny85.txt (2.99 KB)