I would like to make my sketch running, but I have some problems with it. It’s a controller for flashlight based on atmega328p. After hooking power supply to Uno, digital pin 7 goes high (which would be later connected to enable pin of dc/dc driving power Leds). Pin 6 spreads pwm (dimming function) with variable duty cycle according to how many times button is pressed (it switches throught 3 modes with different duty cycle). To turn the flashlight off the button should be pressed for 2,5 s, which it does. The problem is that after turning off, it doesn’t want to turn on, when the button is pressed (interrupt comes in). When I press the button, pins 6 and 7 go high just for very short time and go low again. I would like it to power on when i pressthe button. Code also implements battery voltage measuring and other features but they are not the case. Button is connecting pin to supply voltage and pulldown resistor is added.
LowPower.h (3.13 KB)
dolampki.ino (6.4 KB)