Ethernet - Ethernet.setLocalIP()

Description

Set the IP address of the device. Not for use with DHCP.

Syntax

Ethernet.setLocalIP(local_ip)

Parameters

  • local_ip: the IP address to use (IPAddress)

Returns

Nothing

Example

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);

void setup() {
  Ethernet.begin(mac, ip);
  IPAddress newIp(10, 0, 0, 178);
  Ethernet.setLocalIP(newIp);  // change the IP address
}

void loop () {}