Lately also a little C & C++ as it's needed in MCU's.
Now i have finally a esp8266, the olimex DEV version with alot of pins... 22 if i remember correctly.
I have 3 problems:
I use the arduino ide to program the esp8266 and everything works as expected for now.anyway:
1. What is the latest ESP8266 Firmware? or is there a specific Arduino ide based firmware? or when i program the module it uploads a custom firmware just created? i tried the nodemcu firmware but it had to many problems.
i ask because i have 2 modules and one appears to be slower even with the same code.
There is no way to make the AP (Access Point) work properly.
2. No matter what i do the AP does not return a correct WiFi.status(), sometimes it does not connect, sometimes it connects very slow, sometimes it connects but the conecction speed is ridiculous (i'm using it only as websocket server)
void setup(){
WiFi.softAP("ssid","pass");
}
void loop(){
websocket.loop();
}
3. Said the above , what i'm trying to do is to create, with some leds, a simple connection manager*: try to connect in infrastructure to an existing network. if no connection after 10 seconds connect create an AP.All this in setup as the loop needs to be fast.
void setup(){
WiFi.begin("ssid","pass");
uint16_t timeout=10000;
uint16_t start=millis();
boolean fk=true;
while(WiFi.status()!=WL_CONNECTED&&fk){
if(millis()-start>timeout){
fk=false;
}
delay(40);
}
if(fk){
Serial.println('Infrastructure');
}else{
WiFi.disconnect();
WiFi.softAP("ssidAP","pass");
start=millis();
fk=true;
while(WiFi.status()!=WL_CONNECTED&&fk){
if(millis()-start>timeout){
fk=false;
}
delay(40);
}
if(fk){
Serial.println('AccesPoint');
}else{
ESP.restart();
}
}
}
I tested with various versions of the above code. Nothing seems to work properly.Including
MultiWiFi.addAP("ssid","pass");
while(MultiWiFi.run()!=WL_CONNECTED){
// do some delay
}
*the wifi connection manager lib does not work on the stable version.I'm using that one.
here is somethig i'm currently playing with which works only if i have AP&Infrastructure or only Infrastructure.
With some luck it also works in AP only mode but really the connections is unusable.
https://www.youtube.com/watch?v=-njWqbZT9G0