說明
告訴您鏈接是否處於活動狀態。 LinkOFF 可能表示以太網電纜已拔出或有缺陷。此函數僅在使用 W5200 和 W5500 以太網控製器芯片時可用。
用法
Ethernet.linkStatus()
參數
空
返回
-
鏈路狀態(EthernetLinkStatus):
-
Unknown
-
LinkON
-
LinkOFF
示例
#include <SPI.h>
#include <Ethernet.h>
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop () {
if (Ethernet.linkStatus() == Unknown) {
Serial.println("Link status unknown. Link status detection is only available with W5200 and W5500.");
}
else if (Ethernet.linkStatus() == LinkON) {
Serial.println("Link status: On");
}
else if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Link status: Off");
}
}
相關用法
- Arduino Ethernet - Ethernet.localIP()用法及代碼示例
- Arduino Ethernet - Ethernet.setRetransmissionTimeout()用法及代碼示例
- Arduino Ethernet - Ethernet.MACAddress()用法及代碼示例
- Arduino Ethernet - Ethernet.hardwareStatus()用法及代碼示例
- Arduino Ethernet - Ethernet.setDnsServerIP()用法及代碼示例
- Arduino Ethernet - Ethernet.init()用法及代碼示例
- Arduino Ethernet - Ethernet.setMACAddress()用法及代碼示例
- Arduino Ethernet - Ethernet.setSubnetMask()用法及代碼示例
- Arduino Ethernet - Ethernet.dnsServerIP()用法及代碼示例
- Arduino Ethernet - Ethernet.setLocalIP()用法及代碼示例
- Arduino Ethernet - Ethernet.gatewayIP()用法及代碼示例
- Arduino Ethernet - Ethernet.setGatewayIP()用法及代碼示例
- Arduino Ethernet - Ethernet.setRetransmissionCount()用法及代碼示例
- Arduino Ethernet - Ethernet.begin()用法及代碼示例
- Arduino Ethernet - Ethernet.subnetMask()用法及代碼示例
- Arduino Ethernet - EthernetUDP.parsePacket()用法及代碼示例
- Arduino Ethernet - EthernetUDP.beginPacket()用法及代碼示例
- Arduino Ethernet - EthernetUDP.available()用法及代碼示例
- Arduino Ethernet - EthernetUDP.read()用法及代碼示例
- Arduino Ethernet - EthernetUDP.endPacket()用法及代碼示例
- Arduino Ethernet - EthernetUDP.begin()用法及代碼示例
- Arduino Ethernet - EthernetServer()用法及代碼示例
- Arduino Ethernet - EthernetClient()用法及代碼示例
- Arduino Ethernet - EthernetUDP.write()用法及代碼示例
- Arduino Ethernet - server.begin()用法及代碼示例
注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 Ethernet - Ethernet.linkStatus()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。