Ethernet.localIP()
描述
取得 86Duino 的 IP位址。当 IP 被 DHCP 自动分配时,此函式是很有用的。
语法
Ethernet.localIP();
参数
回传
86Duino 的 IP 位址。
范例
#include <Ethernet.h>
void setup() {
// 初始化序列埠
Serial.begin(9600);
// 初始化 Ethernet
if (Ethernet.begin() == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// 不做任何事
for(;;)
;
}
// 印出 86Duino 的 IP 位址
Serial.println(Ethernet.localIP());
}
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.
