---
title: "Arduino Event driven Ethernet library for W5100"
url: "https://maker.wiznet.io/teamprof/contest/arduino-event-driven-ethernet-library-for-w5100/"
markdown_url: "https://maker.wiznet.io/teamprof/contest/arduino-event-driven-ethernet-library-for-w5100/md"
type: "Contests"
author: "teamprof"
author_url: "https://maker.wiznet.io/teamprof/"
original_author: "teamprof"
published: "2022-02-13"
language: "en"
likes: 0
views: 1936
comments: 1
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Arduino Event driven Ethernet library for W5100

> Arduino Event driven Ethernet library for W5100

Original author: teamprof

## Components

- Software: **Event driven Ethernet library**: initial release

## Documents and links

- [Event Driver Ethernet library](https://github.com/teamprof/arduino-eventethernet) (code): initial release
- [Event Driver Ethernet library zip file](http://maker.wiznet.io/wp-content/uploads/2022/04/EventEthernet.zip) (code): initial release
- [screenshot-arduino-ide](http://maker.wiznet.io/wp-content/uploads/2022/04/screenshot-arduino-0.jpg): screenshot on arduino ide
- [screenshot-terminals](http://maker.wiznet.io/wp-content/uploads/2022/04/screenshot-terminals-1.jpg): screenshot on linux terminals

## Article

This library is to facilitate your usage of W5100S-EVB-Pico board with the onboard Wiznet W5100S chip, using [**Arduino-mbed RP2040** core](https://github.com/arduino/ArduinoCore-mbed)

In case you are looking for an event driven approach of receiving Ethernet data/status, rather than the traditional polling method, this library may be one of choices for you.

Events to be dispatched to: void (*EthernetEventCallback)(uint8_t ir, uint8_t ir2, uint8_t slir);

1. Interrupt Register (IR)

? ? ?EthernetEventApi::Ir::CONFLICT

? ? ?EthernetEventApi::Ir::UNREACH

? ? ?EthernetEventApi::Ir::PPPTERM

? ?note: NO Sn_INT events in EthernetEventCallback. User should use Sn_IR in SocketEventCallback

2. Interrupt Register 2 (IR2)

? ? ?EthernetEventApi::Ir2::WOL

3. SOCKET-less Interrupt Register (SLIR)

? ? ?EthernetEventApi::Slir::TIMEOUT

? ? ?EthernetEventApi::Slir::ARP

? ? ?EthernetEventApi::Slir::PING

Events to be dispatched to: void (*SocketEventCallback)(uint8_t sn_ir);

1. SOCKET n Interrupt Register (Sn_IR)

? ? SnIR::SEND_OK

? ? SnIR::TIMEOUT

? ? SnIR::RECV

? ? SnIR::DISCON

? ? SnIR::CON

### User's Code comparison:

#### Using [EventEthernet](https://github.com/teamprof/arduino-eventethernet)

############################################################################

#include &lt;EventEthernet.h>

void setup() {

? Ethernet.init(17, 21); // W5100S-EVB-Pico: nCS pin = GPIO17, Intn pin = GPIO21

? while (Ethernet.begin(mac, ir, ir2, slir, onEthernetEvent) == 0)

? {

? ? LOG_DEBUG("Failed to configure Ethernet using DHCP");

? ? delay(1000);

? }

}

############################################################################

#### Using original [WIZnet-ArduinoEthernet](https://github.com/WIZnet-ArduinoEthernet/Ethernet)

############################################################################

#include &lt;Ethernet.h>

//#include &lt;EventEthernet.h> // note: you can use EventEthernet lib on existing code with polling method

void setup() {

? Ethernet.init(17); // W5100S-EVB-Pico: nCS pin = GPIO17

? while (Ethernet.begin(mac) == 0)

? {

? ? LOG_DEBUG("Failed to configure Ethernet using DHCP");

? ? delay(1000);

? }

}

---

Source: https://maker.wiznet.io/teamprof/contest/arduino-event-driven-ethernet-library-for-w5100/
