× General topics about hardware.

static ip for esp8266?

8 years 3 months ago #2725 by itomailg
Replied by itomailg on topic static ip for esp8266?
For ip static (no Arduino)
#include <ESP8266WiFi.h>
String ssid = "ssid";
String password = "password";
void setup() {
  IPAddress ip(192, 168, 1, 17);
  IPAddress subnet(255, 255, 255, 0);
  IPAddress gt(192, 168, 1, 1);
  Serial.begin(115200);
  char charBuf[50];
  char charBuf2[50];
  ssid.toCharArray(charBuf, 50);
  password.toCharArray(charBuf2, 50);
  WiFi.config(ip, gt, subnet);
  WiFi.begin(charBuf , charBuf2);

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  // put your main code here, to run repeatedly:

}

Please Log in or Create an account to join the conversation.

8 years 1 month ago #3091 by matteo_vr
Replied by matteo_vr on topic static ip for esp8266?
... And for "whit arduino"? change esp8266easyiotconfig.h ?
:-) tank's

Please Log in or Create an account to join the conversation.

7 years 10 months ago #3380 by stha2232
Replied by stha2232 on topic static ip for esp8266?
How to input: AT+CIPSTA= 192.168.1.100

Please Log in or Create an account to join the conversation.

Time to create page: 0.334 seconds

Forum latest

  • No posts to display.