wifi connect
Posted: Tue Jun 26, 2018 3:30 am
I turn off the router first, then turn on esp32 to show that I am connecting WiFi and then turn on the router, but esp32 will never connect to the router forever.
#include "WiFi.h"
#include "esp_wifi.h"
//#include "esp_wifi_types.h"
const char* ssid ="UT-9061";
const char* ssid2 ="TP-LINK_BE5F";
const char*password2 = "yutaikeji123456@";
const char* ssid3 ="zhangfeitest";
const char*password3 = "13688313408";
const char* ssid4 ="zftest";
const char*password4 = "12345678";
void setup()
{
Serial.begin(115200);
delay(10);
Serial.println("##################");
delay(1000);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid2, password2);
while (WiFi.status()!= WL_CONNECTED) {
delay(500);
Serial.println("Connectingto WiFi..");
}
Serial.println("Connectedto the WiFi network");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP());
}
void loop() {
delay(1000);
Serial.print("IP address:\t");
Serial.println(WiFi.localIP());
Serial.print("channel:");
Serial.print(WiFi.channel());
Serial.print("rssi:");
Serial.print(WiFi.RSSI());
}
#include "WiFi.h"
#include "esp_wifi.h"
//#include "esp_wifi_types.h"
const char* ssid ="UT-9061";
const char* ssid2 ="TP-LINK_BE5F";
const char*password2 = "yutaikeji123456@";
const char* ssid3 ="zhangfeitest";
const char*password3 = "13688313408";
const char* ssid4 ="zftest";
const char*password4 = "12345678";
void setup()
{
Serial.begin(115200);
delay(10);
Serial.println("##################");
delay(1000);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid2, password2);
while (WiFi.status()!= WL_CONNECTED) {
delay(500);
Serial.println("Connectingto WiFi..");
}
Serial.println("Connectedto the WiFi network");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP());
}
void loop() {
delay(1000);
Serial.print("IP address:\t");
Serial.println(WiFi.localIP());
Serial.print("channel:");
Serial.print(WiFi.channel());
Serial.print("rssi:");
Serial.print(WiFi.RSSI());
}