Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Boyan Djumakov
#37512 Hi everybody,
I, as all other here, play with ESP8266 for the Home Automation. I need to have a 'configuration' mode on the different nodes activated somehow. It will be used for general configs like WiFi settings, MQTT setup and etc.
One of the options, I have seen and used in LUA script is to wait for a button click within 5 sec from the powering of the esp in which case an AP and Web Server would be fired, otherwise, a normal execution is started.
In LUA I used a timer of 5 secs that at the end checked if the button has been pushed at least once within that period and if so, I run the 'config.lua' script, otherwise I run the 'main.lua' .

I want to implement similar behavior but in ESP-Arduino C code, as I don't want to run a whole AP and a Web Server all the time when it's needed once a year.
Anyone that could help with at least a working idea is welcome.
BTW if anyone has an alternative idea, it's welcome as well :)

Thanks,
Boyan.
User avatar
By Boyan Djumakov
#37680 10x I'll try it out... I thought that it would interfere with the initial push for programming mode, if I put that button on GPIO0.
For this "In setup() just check if button is pressed at startup, then branch to first init ..." can you give me a quick example?
Do you mean to set a flag in setup() based on that button state and in main to execute a setup function instead of calling a proper main loop? Or is there a better way to do it?

10x,
Boyan.