Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static IP #23

Open
MartinMeise opened this issue Jul 15, 2024 · 0 comments
Open

Add static IP #23

MartinMeise opened this issue Jul 15, 2024 · 0 comments

Comments

@MartinMeise
Copy link

MartinMeise commented Jul 15, 2024

I would like to set a fixed IP for the HCPBridge but I was not able to find an input field for this.

After I looked into the main.cpp i found the following code:

//setup wifi
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  WiFi.setAutoReconnect(true);
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
  }

Accoring to this Website: https://randomnerdtutorials.com/esp32-static-fixed-ip-address-arduino-ide/
Something like this would be needed:

// Set your Static IP address
IPAddress local_IP(192, 168, 1, 184);
// Set your Gateway IP address
IPAddress gateway(192, 168, 1, 1);

IPAddress subnet(255, 255, 0, 0);
IPAddress primaryDNS(8, 8, 8, 8); // optional
IPAddress secondaryDNS(8, 8, 4, 4); // optional
// Configures static IP address
if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
  Serial.println("STA Failed to configure");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant