Enter wifi password or ssid
In Arduino, you can manually enter the password for a Wi-Fi network and disable the SSID auto-detection. To achieve this, you will need to use the "WiFi.begin(ssid, password)" function, where "ssid" is the name of your Wi-Fi network and "password" is the corresponding password.
Here's an example Arduino code that demonstrates how to do this:
#include <WiFi.h>
const char* ssid = "Your_WiFi_SSID";
const char* password = "Your_WiFi_Password";
void setup() {
Serial.begin(115200);
// Manually connect to the Wi-Fi network with the provided SSID and password
WiFi.begin(ssid, password);
Serial.print("Connecting to ");
Serial.print(ssid);
// Wait until the Wi-Fi connection is established
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected! IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// Your main code goes here
}
In this code, you need to replace "Your_WiFi_SSID" with the name of your Wi-Fi network and "Your_WiFi_Password" with the corresponding password. The "WiFi.begin(ssid, password)" function initiates the connection process, and the program waits in the loop until a connection is established. Once connected, it prints the local IP address to the serial monitor.
Remember that if you change your Wi-Fi network or password, you will need to update the code accordingly and re-upload it to your Arduino board.
Comments
Post a Comment