Ethernet - Ethernet.setMACAddress()

Description

Set the MAC address. Not for use with DHCP.

Syntax

Ethernet.setMACAddress(mac)

Parameters

  • mac: the MAC address to use (array of 6 bytes)

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);
  byte newMac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02};
  Ethernet.setMACAddress(newMac);  // change the MAC address
}

void loop () {}