BIMA-25 / Final_Project_KEL8

final project
1 stars 1 forks source link

TA-PROGRES 4 BIKIN CODE WIFI MANAGER #22

Closed BIMA-25 closed 1 year ago

BIMA-25 commented 1 year ago

https://randomnerdtutorials.com/esp32-wi-fi-manager-asyncwebserver/

BIMA-25 commented 1 year ago

https://www.teachmemicro.com/esp32-wifi-manager-dynamic-ssid-password/?_x_tr_sl=en&_x_tr_tl=id&_x_tr_hl=id&_x_tr_pto=sc

BIMA-25 commented 1 year ago

https://github.com/rpolitex/ArduinoNvs

BIMA-25 commented 1 year ago

include // https://github.com/tzapu/WiFiManager

void setup() { // WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // it is a good practice to make sure your code sets wifi mode how you want it. // put your setup code here, to run once: Serial.begin(115200);

//WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wm;

// reset settings - wipe stored credentials for testing
// these are stored by the esp library
// wm.resetSettings();

// Automatically connect using saved credentials,
// if connection fails, it starts an access point with the specified name ( "AutoConnectAP"),
// if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
// then goes into a blocking loop awaiting configuration and will return success result

bool res;
// res = wm.autoConnect(); // auto generated AP name from chipid
// res = wm.autoConnect("AutoConnectAP"); // anonymous ap
res = wm.autoConnect("AutoConnectAP","password"); // password protected ap

if(!res) {
    Serial.println("Failed to connect");
    // ESP.restart();
} 
else {
    //if you get here you have connected to the WiFi    
    Serial.println("connected...yeey :)");
}

}

void loop() { // put your main code here, to run repeatedly:
}

BIMA-25 commented 1 year ago

link library wifimanager

https://github.com/tzapu/WiFiManager