Site Navigation

Your Account

Choose Language

Is there any way to store information when the flashlight is off?

I have a program similar to the factory program, but it allows you to turn off the light without cycling through all brightnesses. I'd like to store the last brightness when I turn it off so that I can return it to that brightness when I turn it back on. I have it working fine when plugged in to USB but when I unplug it loses the bit that stores the brightness setting. Is there any way around this?

EDIT: Figured it out! EEPROM. New to this arduino thing.

Answered! View the answer I have this problem too

Is this a good question?

Score 0
Add a comment

1 Answer

Chosen Solution

include this in your program:

#include <EEPROM.h>

Read a value this way:

value =;

Write a value this way:


Make sure that you read and check a value before writing. EEPROM supports fairly limited rewrite cycles.

Was this answer helpful?

Score 0


Yeah. If you're using a continuous light output scale (let's say 1-1000), I'd only write the value if it's more than 100 different.


I'm actually just storing a digit that relates to the brightness, e.g. 1 for low, 2 for med, 3 for bright. It's working great, thanks for the help!


Add a comment

Add your answer

Luke Wilson will be eternally grateful.
View Statistics:

Past 24 Hours: 0

Past 7 Days: 0

Past 30 Days: 0

All Time: 156