rstephan / ArtnetWifi

Arduino library for Art-Net (artnet) over WiFi, send and receive DMX data. Runs on ESP8266, ESP32, Pi Pico W, WiFi101 and WiFiNINA devices.
Other
368 stars 63 forks source link

Is it possible to manually set the IP Address? #33

Closed star-dust-1 closed 3 years ago

star-dust-1 commented 3 years ago

Just curious if there's a variable I can use to set the IP Address of my ESP8266 board manually in the code instead of the board choosing an address automatically? I'm having the issue where if I reset my modem and the board the IP Address changes and then my other software that's trying to point to it can't find it anymore.

Thanks!

Teasel-Github commented 3 years ago

There's probably an option in your router's DHCP config which will ensure that your ESP8266 is always given the same IP address, based on its MAC address. Or you can set a static IP address in your code...

IPAddress local_IP(192, 168, 1, 184);

IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 0, 0);
IPAddress primaryDNS(8, 8, 8, 8);
IPAddress secondaryDNS(8, 8, 4, 4);

WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS);
star-dust-1 commented 3 years ago

I'll give it a try, thanks!

Update - I added that bit into my code and it's now letting me set the IP address, thanks again!