kitesurfer1404 / WS2812FX

WS2812 FX Library for Arduino and ESP8266

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switch on / off Webinterface

AlejandroSantosG opened this issue · comments

Hello Guys I want to add a switch on / off for the Esp8266 webinterface could someone help Please, Thanks

commented

I use a similar function, but only built it in to avoid problems with WiFi. You can use "WiFi.mode(WIFI_OFF);"
I use this in void setup(), so I can simply deactivate the wifi function when starting or reset by pressing the program switch.
The switch is normal on HIGH.

int buttonstate = digitalRead(BUTTON_PIN);
  if(buttonstate==LOW){
    WiFi.mode(WIFI_OFF);
  }else{
    WiFi.mode(WIFI_AP);                <------- OR WIFI_STA, what you need
    WiFi.softAP(ssid);
  }

But I have never tried whether it is possible to change the WiFi mode in a loop with an "if" function.