[英]Arduino Ethernet Shield Not Assigning Correct IP Address
我已經購買了兩個Arduino制造的Arduino以太網屏蔽。 我正在為我的項目使用Arduino Uno。 我似乎無法為屏蔽分配IP地址。 當我運行以下代碼時,我收到0.253.253.253作為其中一個屏蔽的IP,對於另一個我收到0.15.15.15,具有完全相同的代碼。 我不知道這是怎么回事。 任何幫助,將不勝感激。 謝謝
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0x30, 0x71 };
IPAddress ip(192,168,1,22);
void setup() {
Serial.begin(9600);
// disable SD card if one in the slot
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
delay(5000);
Serial.println("Starting w5100");
Ethernet.begin(mac, ip);
Serial.println(Ethernet.localIP());
}
void loop() {
}
如果兩個板都連接在同一網絡上,則它們不能具有相同的IP地址,請更改其中一個板的地址。
編輯:檢查它是否確實正確啟動
if(!Ethernet.begin(mac, ip))
Serial.println("failed");
else
Serial.println(Ethernet.localIp());
也可以嘗試不帶IP的路由器,以檢查路由器是否可以分配IP地址。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.