Причем тут IPv6Address ? Вы, вообще, в курсе что это такое?
вот и я не понимаю причем тут это. Однако выдает это:
Спойлер
c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/WebServer_ESP32_SC_W5500.h:62,
from C:\arduino\test\test.ino:81:
c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/w5500/esp32_sc_w5500.h:82:5: error: ‘IPv6Address’ does not name a type; did you mean ‘IPAddress’?
82 | IPv6Address localIPv6();
| ^~~~~~~~~~~
| IPAddress
c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/w5500/esp32_sc_w5500.h:96:18: error: using typedef-name ‘WiFiClient’ after ‘class’
96 | friend class WiFiClient;
| ^~~~~~~~~~
In file included from C:\Users\USER\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\libraries\WiFi\src/WiFi.h:39,
from c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/w5500/esp32_sc_w5500.h:26:
C:\Users\USER\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\libraries\WiFi\src/WiFiClient.h:3:23: note: ‘WiFiClient’ has a previous declaration here
3 | typedef NetworkClient WiFiClient;
| ^~~~~~~~~~
c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/w5500/esp32_sc_w5500.h:96:5: error: friend declaration does not name a class or function
96 | friend class WiFiClient;
| ^~~~~~
c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/w5500/esp32_sc_w5500.h:97:18: error: using typedef-name ‘WiFiServer’ after ‘class’
97 | friend class WiFiServer;
| ^~~~~~~~~~
In file included from C:\Users\USER\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\libraries\WiFi\src/WiFi.h:40:
C:\Users\USER\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\libraries\WiFi\src/WiFiServer.h:3:23: note: ‘WiFiServer’ has a previous declaration here
3 | typedef NetworkServer WiFiServer;
| ^~~~~~~~~~
c:\Users\USER\Documents\Arduino\libraries\WebServer_ESP32_SC_W5500-main\src/w5500/esp32_sc_w5500.h:97:5: error: friend declaration does not name a class or function
97 | friend class WiFiServer;
Нет. Моя цель пока что просто загрузить по адресу 192.168.2.177 веб страницу взятую из данной платы, а далее уже делать ее под свои цели. Ранее я брал ардуино нано и w5500, подключал библиотеку и все работало. а с этой палатой ничего понять не могу
Вы бы хотя бы открыли пример в библиотеке. Там есть закомментированные строки, показывающие как иницировать этот модуль на разных платах.
void setup() {
// You can use Ethernet.init(pin) to configure the CS pin
//Ethernet.init(10); // Most Arduino shields
//Ethernet.init(5); // MKR ETH Shield
//Ethernet.init(0); // Teensy 2.0
//Ethernet.init(20); // Teensy++ 2.0
//Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet
//Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet
только сначала выясните, какой пин используется как CS на вашей плате.
Потом хорошо бы делать проверку, запустился ли модуль, прежде чем на нанего вешать сервер.
все равно не пойму почему не работает. По схеме SCSn имеет 14 PIN, остальные пины совместимы со схемой и библиотекой.
подключаю этот пин, но все равно не пашет(
схему взял с оф сайта ссылку которого ранее скидывал.
все пины сравнивал с подключением W5500 и arduino нано.
разница только в том, что вместо 10 PIN используется 14, как ранее написал…
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);
EthernetServer server(80);
void setup() {
Ethernet.init(14); // Подключаю 14PIN
// 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
}
Serial.println("Ethernet WebServer Example");
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
while (true) {
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// start the server
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an HTTP request ends with a blank line
bool currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the HTTP request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard HTTP response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}
в мониторе получаю:
Ethernet WebServer Example
Ethernet shield was not found. Sorry, can’t run without hardware.
Там, скорее нужен совет, что делать. Но тут мы мало что можем без физического доступа к сборке.
@Alex114 у Вас где-то нет контакта. Это может быть где угодно, так что мультиметр (или осциллограф) в руки и вперёд – искать. И не верьте, что всё в порядке. Не можете найти, ищите упорнее.
Надо определить, на каких пинах на этой плате по умолчанию поднимается SPI
Сравнить пины из п. 1 с теми, к которым реально подключен Эзернет модуль
Еще раз проверить, куда физически подключен CS и насколько это совпадает с тем, что ожидает библиотека
Кроме того, поправьте меня, но по-моему на многих платах ЕСП есть чехарда с номерами пинов. То есть обозначения, написанные на текстолите платы рядом с пином, могут не совпадать с номером пина в Ардуино. Если тут так же - то нужно выяснить по каждому пину его “ардуиновский” номер