retain program state in Huzzah upon powercycle

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
zambre
 
Posts: 38
Joined: Thu Mar 24, 2016 2:18 pm

retain program state in Huzzah upon powercycle

Post by zambre »

Hi,

i am working on Adafruit HUZZAH ESP8266. i like it and all the tools and software works great., EXCEPT ONE PROBLEM.
I have to reload the script upon power cycle. how can i maintain the program state or assigned variables so that upon powercyle the program will start without having to reload the script.

in my simple program i am using (including libraries) and using #define to assign variables such as #define WLAN_SSID, #define WLAN_PASS, #define AIO_SERVER etc.

it seems upon disconnecting power the memory is cleared.

Can you please suggest a method to retain all the information, so that upon power cycle, the program will load and start executing without any additional step.

thank you very much ....

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: retain program state in Huzzah upon powercycle

Post by Franklin97355 »

Unless you add a battery or other power source the memory is lost on power loss. If you want to save values you would need to write them to some form of storage medium and reload them on power up. What does your program require when it starts that it does not have available?

User avatar
zambre
 
Posts: 38
Joined: Thu Mar 24, 2016 2:18 pm

Re: retain program state in Huzzah upon powercycle

Post by zambre »

Hi,

thank you for your reply, i have simple MQTT client application, which connect to io.adafruit.com,
post dht22 sensor data, and i also have two on off buttons.

i want to learn how can i developed an application which can automatically start upon power up, read sensor values and post them. and also check status of on off buttons.

this is a simple application. the objective is to l;earn and figure out how to write software with personality similar to the one that an be implemented in Raspberry pi, where upon boot, it start the application without any user input.

I am new to Android and android IDE.

i was wondering if i can store variables and program in non volatile memory (may be in sd card,) and run the program upon
esp8266 boot.

thanks

User avatar
zambre
 
Posts: 38
Joined: Thu Mar 24, 2016 2:18 pm

Re: retain program state in Huzzah upon powercycle

Post by zambre »

hi,

is there a way to store and load variables and program in SD card? which can be loaded and executed upon powering the esp8266 breakout card.

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: retain program state in Huzzah upon powercycle

Post by Franklin97355 »

Yes, you can store and read from the SD card using the SD library.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”