Arduino IDE: The IP address was not printing in serial monitor

23 Views Asked by At

I am currently trying to turn on and off the led in webclient so i need to get the ip address but it is not printing instead this is the output the i receive:

rst:0x8 (TG1WDT_SYS_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0030,len:1344 load:0x40078000,len:13964 load:0x40080400,len:3600 entry 0x400805f0 ets Jul 29 2019 12:21:46

I am currently using w5500 for Ethernet Module and ESP Wroom 32 for Microcontroller. I am also thinking that it was in the connections of wire of w5500 and ESP32. The pins are SCLK-gpio18, SCS-gpio5, MOSI-gpio23, MISO-gpio19, INT-EN, RST-gpio26. What seems to be the problem?

This is my code:

#include <SPI.h>
#include <Ethernet.h>

int led = 4;

// MAC address should be unique for each device on the network
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

EthernetServer server(80);

String readString;

void setup() {
// Start serial communication for debugging
Serial.begin(115200);
pinMode(led, OUTPUT);

// Attempt to configure Ethernet using DHCP
Ethernet.begin(mac);
server.begin();
Serial.print("Server is at ");
Serial.println(Ethernet.localIP());
}


void loop() {
// Your main code goes here
EthernetClient client = server.available();


if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.print(c);

if (readString.length() < 100) {
readString += c;
}

if (c == '\n') {
Serial.print(readString);
client.println("<HTTP/1.1 200 OK>");
client.println("<Connection-Type: text/html>");
client.println("<Connection: close>");
client.println();

client.println("<!DOCTYPE html>");
client.println("<html>");
client.println("<head>");
client.println("<title>Webserver</title>");
client.println("</head>");
client.println("<body>");
client.println("<a ref=\"/?button1on\"\"><button>LED ON</button></a>");
client.println("<a ref=\"/?button2off\"\"><button>LED OFF</button></a>");
client.println("<body style=background-color:powderblue>");

delay(1);
client.stop();
if (readString.indexOf("?buttton1on") > 0) {
digitalWrite(led, HIGH);
}
if (readString.indexOf("?buttton2off") > 0) {
digitalWrite(led, LOW);
}
readString = "";
}
}
}
}
}

I try doing this https://community.m5stack.com/topic/3068/lan-module-w5500-with-poe-compilation-error since before the ethernetserver was the problem but now i dont know.

0

There are 0 best solutions below