Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem With Ethernet Port
#1
I have the following Arduino code and I can not get my A32 Pro to connect to the network and take IP, in the port if I see that there is connection but I can not get it to take an IP address from the DHCP of my network.

Code:
#ifndef ETH_PHY_TYPE
#define ETH_PHY_TYPE  ETH_PHY_LAN8720
#define ETH_PHY_ADDR  0
#define ETH_PHY_MDC   23
#define ETH_PHY_MDIO  18
#define ETH_PHY_POWER -1
#define ETH_CLK_MODE  ETH_CLOCK_GPIO0_IN
#endif

#include <ETH.h>
#include "Arduino.h"
#include "PCF8574.h"
#include <Wire.h>
#include <WiFi.h>
#include <Ethernet.h>
#include <SPI.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include "esp_system.h"
#include "esp_task_wdt.h"

EthernetClient ethClient;
PubSubClient client(ethClient);

void setup() {
  Serial.begin(115200);
 
  ETH.begin();

  while (Ethernet.localIP() == INADDR_NONE) {
    Serial.println("Esperando dirección IP...");
    delay(1000);  // Esperar 1 segundo antes de verificar nuevamente
  }
 
  while (ETH.localIP() == INADDR_NONE) {
    Serial.println("Esperando dirección IP...");
    delay(1000);  // Esperar 1 segundo antes de verificar nuevamente
  }

  while (!ETH.linkUp()) {
    Serial.print(".");
    delay(1000);
  }

  Serial.println("");
  Serial.println("Ethernet conectado");
}
Reply


Messages In This Thread
Problem With Ethernet Port - by rferreras - 08-06-2024, 11:51 PM
RE: Problem With Ethernet Port - by admin - 08-07-2024, 02:29 AM
RE: Problem With Ethernet Port - by rferreras - 08-07-2024, 04:50 PM
RE: Problem With Ethernet Port - by admin - 08-07-2024, 09:51 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)