Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
- void setup() {
- Serial.begin(9600);
- Connect_To_WiFi();
- // put your setup code here, to run once: ↓
- }
- void loop() {
- ReConnect_To_WiFi();
- // put your main code here, to run repeatedly: ↓
- }
- void ReConnect_To_WiFi() {
- while (WiFi.status() != WL_CONNECTED) {
- //delay(500);
- Serial.print(".");
- Connect_To_WiFi();
- }
- }
- void Connect_To_WiFi() {
- WiFiManager wm;
- bool res;
- res = wm.autoConnect("Senior Project [Setup WiFi]"); // 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...");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement