- Thu Oct 09, 2014 1:39 am
#1456
@zarya
I use Your wonderful modification from gist "Simple autostarting example to toggle GPIO2 via tcp/udp",
it contains everything I need with one small exception
![Smile :)](./images/smilies/icon_e_smile.gif)
I moved Your code from user_main.c to additional wifi_connect.c file
Code: Select all#include "user_interface.h"
#include "ip_addr.h"
#include "osapi.h"
#include "c_types.h"
#include "mem.h"
#define sleepms(x) os_delay_us(x*1000);
void ICACHE_FLASH_ATTR
wifi_init(void)
{
sleepms(500);
uart0_sendStr("Setting MUX to 1:");
at_setupCmdCipmux(15, "=1");
sleepms(500);
at_queryCmdCipmux(15);
sleepms(500);
uart0_sendStr("Starting TCP server:");
at_setupCmdCipserver(16, "=1,9999");
}
and everything works ok
but...
my esp8266 will operate in three networks, with of course different SSIDs/PASSWORDs: in my home, sister home, brother home
so...how to add functionality to check and select appropriate/available network on ESP8266 startup?
...and finally, when any of declared networks is not available then start ESP in AP mode with its own declared SSID