Ethernet.localMAC()

[Ethernet]

描述

Obtains the MAC (Media access control) address of the 86Duino. This function is available from 86Duino Coding 102.

語法

Ethernet.localMAC();

參數

回傳

an array of 6 bytes that contains the MAC address of the 86Duino

範例

#include <Ethernet.h>
 
void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin() == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // print your MAC address:
  byte *mac = Ethernet.localMAC();
  for (int i=0; i<6; i++)
  {
    Serial.print(mac[i], HEX);
    Serial.print(" ");
  }
}
 
void loop() {
 
}

函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール