How to Assign a Static / Fixed IP Address | ESP8266 | ESP32 | Arduino

Опубликовано: 17 Сентябрь 2020
на канале: Mish Mash Labs
32,705
466

Mish Mash Labs present how to set a static of fixed IP address for your Espressif ESP8266, ESP32 or Arduino Board.
If you’re running a web server or client over WiFi or Ethernet with your Espressif ESP8266, ESP32 or Arduino Board and every time you restart your board it has a new IP address which is what happens when you use the default DHCP (Dynamic Host Configuration Protocol) you can follow this tutorial to change the settings to assign a static or fixed IP address.

Code used:
Before the setup loop:
// Set your Static IP Address Settings
IPAddress local_IP(192, 168, 1, 199);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 0, 0);
IPAddress primaryDNS(8, 8, 8, 8); // this is optional
IPAddress secondaryDNS(8, 8, 4, 4); // this is optional

In the setup loop:
// Print feedback if the settings are not configured
if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
Serial.println("STA Failed to configure");
}


See our GitHub for complete sketch:
https://github.com/mishmashlabs/Addin...

#ESP32 #ESP8266 #Arduino #Static #IP #tutorial #mishmash
Instagram: www.instagram.com/mishmashlabs/
Twitter: www.twitter.com/mishmashlabs/

Music Credits:
Intro & Outro by audionautix.com


Смотрите видео How to Assign a Static / Fixed IP Address | ESP8266 | ESP32 | Arduino онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Mish Mash Labs 17 Сентябрь 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 32,705 раз и оно понравилось 466 людям.