So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By moose4621
#75253 I had a great little sketch running on a wemos d1 mini that would log on to my local wifi router, read a ping sensor and the analog voltage divider, upload the data to thingyverse and then go into a deep sleep for an hour then do it all again.

I started printing an enclosure for this project and while it was printing, I had a go at converting a gate opener sketch which used ap mode for direct connection, to enable deep sleep.

My problem now is the wemos will not go out of ap mode. No matter what sketch I upload, it creates an ap named what ever the last ap sketch was.

I've been googling all day and have tried
Code: Select allESP8266WiFiMulti wifiStation; 
WiFiClient client;
ESP8266WiFi.mode(wifi.STATION);
wifi.mode(STATION);

etc.
Nothing seems to work.

The libraries I used on the ap sketch are
Code: Select all#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsServer.h>
#include <Hash.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>


I have even started think about reloading the firmware in an attempt to overwrite the ap mode.

Any help would be appreciated.
User avatar
By moose4621
#75257
schufti wrote:just try
Code: Select all  WiFi.mode(WIFI_STA);
  WiFi.begin(......);


Did not work initially even after a reset but after unplugging it for an hour or so it finally worked. Thanks schufti.
schufti wrote:and instead of googling try reading
https://arduino-esp8266.readthedocs.io/ ... index.html

Yeah, I did come across that site today but didn't see an obvious answer to my problem. I was probably getting sick of looking by then, it had been a few hours.