Ethernet.localMAC()
描述
取得 86Duino 的 MAC 位址。86Duino Coding 102 (含)以後的版本才有支援此函式。
語法
Ethernet.localMAC();
參數
無
回傳
一個包含 86Duino MAC 位址的陣列,大小為 6 bytes。
範例
#include <Ethernet.h>
void setup() {
// 初始化序列埠
Serial.begin(9600);
// 初始化 Ethernet
if (Ethernet.begin() == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// 不做任何事
for(;;)
;
}
// 印出 86Duino MAC 位址
byte *mac = Ethernet.localMAC();
for (int i=0; i<6; i++)
{
Serial.print(mac[i], HEX);
Serial.print(" ");
}
}
void loop() {
}
本頁由熱血自造者 Allen Chang 譯自英文版。
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
