Ethernet.setMACAddress()

名称

Ethernet.setMACAddress()

説明

MACアドレスを設定する。DHCPのときは利用しない。

書式

void EthernetClass::setMACAddress(const uint8_t *mac_address);

引数

mac_address利用するMACアドレス(6バイトの配列)。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#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 () {}

オリジナルのページ

https://www.arduino.cc/reference/en/libraries/ethernet/ethernet.setmacaddress/

最終更新日

January 7, 2024

inserted by FC2 system