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.
