I am using ESP8266 and i am programming it with Lua language. I created a PWM function and i created a server in ESP8266. I can change PWM duty cycle through this server(You can see figure). First i set to PWM with a default value and i am changing the PWM through server with respect to my application. But when i disconnected the ESP8266 from power and connected again to power, duty cycle returned to default value. I want to save last PWM value that i entered through server and when i disconnected the ESP8266 from power and connected again to power, duty cycle set the PWM value to last value i entered through server. For example on the below i set the default PWM value to '512', when i changed the PWM with respect to my application, i saved the last value and after the reconnecting process(i informed above) i took the last PWM value from memory and PWM duty cycle starts with this value. Is there any permanent memory like EEPROM i can use to save last PWM value or any other solution anyone suggest? (i have to use Lua language)
--default PWM value
pwm.setup(2,1000,512);
pwm.start(2);