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.