日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

以太網(wǎng)電纜被拔出什么意思 筆記本以太網(wǎng)網(wǎng)絡(luò)電纜被拔出( 三 )


// 初始化以太網(wǎng)客戶端庫
// 服務器的IP地址和端口
// 您要連接的端口(HTTP默認為端口80):
EthernetClient client;
void setup() {
//啟動串行庫:
Serial.begin(9600);
// 啟動以太網(wǎng)連接:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
//進行下去沒有意義,因此永遠不要做任何事情:
for(;;)
;
}
// 打印您的本地IP地址:
Serial.println(Ethernet.localIP());
}
void loop() {
}
【以太網(wǎng)電纜被拔出什么意思 筆記本以太網(wǎng)網(wǎng)絡(luò)電纜被拔出】
1.8 Ethernet.MACAddress()

  • 描述
用設(shè)備的MAC地址填充提供的緩沖區(qū) 。
  • 語法
Ethernet.MACAddress(mac_address)
  • 參數(shù)
mac_address:緩沖區(qū),用于接收MAC地址(6個字節(jié)的數(shù)組)
  • 返回值

  • 例子
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // 等待串行端口連接 。僅本地USB端口需要
}
Ethernet.begin(mac, ip);
byte macBuffer[6]; // 創(chuàng)建一個緩沖區(qū)來保存MAC地址
Ethernet.MACAddress(macBuffer); // 填滿緩沖區(qū)
Serial.print("The MAC address is: ");
for (byte octet = 0; octet < 6; octet++) {
Serial.print(macBuffer[octet], HEX);
if (octet < 5) {
Serial.print('-');
}
}
}
void loop () {}
  • 串口打印結(jié)果:
The MAC address is: DE-AD-BE-EF-FE-ED
1.9 Ethernet.setDnsServerIP()
  • 描述
設(shè)置DNS服務器的IP地址 。不適用于DHCP 。
  • 語法
Ethernet.setDnsServerIP(dns_server)
  • 參數(shù)
dns_server:DNS服務器的IP地址(IPAddress) 。
  • 返回值

  • 例子
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);
void setup() {
Ethernet.begin(mac, ip, myDns);
IPAddress newDns(192, 168, 1, 1);
Ethernet.setDnsServerIP(newDns); // 更改DNS服務器IP地址
}
void loop () {}
1.10 Ethernet.setGatewayIP()
  • 描述
設(shè)置網(wǎng)絡(luò)網(wǎng)關(guān)的IP地址 。不適用于DHCP 。
  • 語法
Ethernet.setGatewayIP(gateway)
  • 參數(shù)
gateway:網(wǎng)絡(luò)網(wǎng)關(guān)的IP地址(IPAddress) 。
  • 返回值

  • 例子
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
void setup() {
Ethernet.begin(mac, ip, myDns, gateway);
IPAddress newGateway(192, 168, 100, 1);
Ethernet.setGatewayIP(newGateway); // 更改網(wǎng)關(guān)IP地址
}
void loop () {}
1.11 Ethernet.setLocalIP()
  • 描述
設(shè)置設(shè)備的IP地址 。不適用于DHCP 。
  • 語法
Ethernet.setLocalIP(local_ip)
  • 參數(shù)
local_ip:要使用的IP地址(IPAddress) 。
  • 返回值

  • 例子
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Ethernet.begin(mac, ip);
IPAddress newIp(10, 0, 0, 178);
Ethernet.setLocalIP(newIp); // 更改IP地址

推薦閱讀