High Power LED - Fade on, flicker and fade off.

Hi all!

I've come to a bit of a stand still with a small project I'm working on. I have a High power LED driven via a Resistor and MOSFET, that currently fades on and continuously Flickers after a button press. However, I cannot get it to Fade off after a second button press (Using "Button State Change"). Is there a Library/Code that anyone can recommend for reading a switch and performing the actions accordingly? I'm without my Laptop, so I cannot show you my current code :(

Kind Regards

Lewis

Posting the code will help. But a question, are you using the "Delay" function??

I'll have my Laptop tomorrow, so I can soon post the Code. Yes, I'm using the "Delay" function.

Kind Regards

Lewis

"Delay" is the devil's function.

fungus: "Delay" is the devil's function.

^^^^ :D Starting to see this in my own code.

But the delay function is why. To fix this, use the functionality like that in the "BlinkWithoutDelay" example provided in the Arduino IDE. It's also available on their website.

The turning off will occur when your flicker is happening, you just have to hit the button a very precise time. The blinkwithoutdelay code basically reads a button according to time.

Check out that example, and it should be able to help. I'm actually trying to use it in my code as well (I was running into the same problem as you are.)