You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
689 B
27 lines
689 B
void WiFisetup()
|
|
{
|
|
// Set the device as a Station and Soft Access Point simultaneously
|
|
WiFi.mode(WIFI_AP_STA);
|
|
|
|
// Set device as a Wi-Fi Station
|
|
WiFi.begin(ssid, password);
|
|
|
|
digitalWrite(13, HIGH); // светодиод горит
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
delay(1000);
|
|
Serial.println("Setting as a Wi-Fi Station..");
|
|
}
|
|
digitalWrite(13, LOW); // светодиод погашен
|
|
|
|
Serial.print("Station IP Address: ");
|
|
Serial.println(WiFi.localIP());
|
|
Serial.print("Wi-Fi Channel: ");
|
|
Serial.println(WiFi.channel());
|
|
|
|
// Init ESP-NOW
|
|
if (esp_now_init() != ESP_OK) {
|
|
Serial.println("Error initializing ESP-NOW");
|
|
return;
|
|
}
|
|
|
|
}
|
|
|