混水摸魚

[ Arduino ] – W5100 R3 網卡 設定 DNS / subnet / gateway

[javascript]
#include <SPI.h>
#include <Ethernet.h>
static byte mac[] = {0xF0,0x7B,0x4B,0x7C,0x9F};
static byte ip[] = {192,168,0,1};
static byte dns1[] = {168,95,1,1};
static byte subnet[] = {255,255,255,0};
static byte gateway[] = {192,168,199,254};
void setup() {
Serial.begin(9600);
Ethernet.begin(mac, ip, dns1, gateway, subnet);
delay(1000);
Serial.println("connecting…");//輸出字串 連線中…
Serial.print("IP :");
Serial.println(Ethernet.localIP());//輸出取得的IP位置
}
void loop() {
}
[/javascript]

Leave a Comment

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *