iluz/Arduino/w5500_connection_test/w5500_connection_test.ino
2025-06-20 14:47:05 +02:00

42 lines
805 B
C++

#include <SPI.h>
#include <Ethernet3.h>
// Configure MAC address and IP:
byte mac[] = {0x61, 0x2C, 0xF2, 0x09, 0x73, 0xBE};
IPAddress ip(10, 11, 1, 22); // Static IP
// Define CS and RST pins:
#define W5500_CS_PIN 10
#define W5500_RST_PIN 9
IPAddress serverIP(192, 168, 1, 100); // computer
// Don't change
unsigned int port = 5005;
EthernetClient client;
void setup() {
Serial.begin(9600);
// Reset W5500
pinMode(W5500_RST_PIN, OUTPUT);
digitalWrite(W5500_RST_PIN, HIGH);
delay(250);
digitalWrite(W5500_RST_PIN, LOW);
delay(250);
digitalWrite(W5500_RST_PIN, HIGH);
delay(1000);
// Initialize Ethernet:
Ethernet.init(W5500_CS_PIN);
Ethernet.begin(mac, ip);
Serial.print("IP: ");
Serial.println(Ethernet.localIP());
}
void loop() {
// Your network code here
}