-->
Page 1 of 1

How to store gpio on/off status in eeprom?

PostPosted: Tue Oct 04, 2016 12:23 pm
by Sivananth
Hi..

I am a noob. I am using ESP8266 for a simple wifi controlled On/Off switch for home. My requirement is i want to store GPIO pin status (0 or 1) in to eeprom when changes made. So the device can remember previous state when power cut happens (it happens often in my country).

Is it possible? If yes provide me a sample code...

Thanks in advance.

Re: How to store gpio on/off status in eeprom?

PostPosted: Wed Oct 05, 2016 5:36 am
by Barnabybear
Hi, as at 05/10/16UK.
Code: Select all// write a byte to a location.
EEPROM.write( location , value );
EEPROM.commit();

// read a byte from a location
EEPROM.read( location);
e.g.
stored_value = EEPROM.read( location );