[RE] QNEthernet library
Provide a library for simple and efficient Ethernet communication
Project Introduction
QNEthernet is a library for simple and efficient Ethernet communication, providing intuitive APIs and robust functionality.
Key Features
- DHCP Support
- TCP and UDP Communication
- Ethernet Event Handling
Key Functions
- DHCP: Set IP addresses automatically using
Ethernet.begin()
. - Ethernet Link Status: Detect link status changes using
Ethernet.onLinkState()
. - IP Address Changes: Detect IP address changes using
Ethernet.onAddressChanged()
. - Support other events and examples
Code Example
#include <QNEthernet.h>
using namespace qindesign::network;
void setup() {
// Start Ethernet and set IP address using DHCP
Ethernet.begin();
// Detect and print link status changes
Ethernet.onLinkState([](bool state) {
Serial.println(state ? "Link up" : "Link down");
});
// Detect and print IP address changes
Ethernet.onAddressChanged([](IPAddress ip) {
Serial.print("IP Address: ");
Serial.println(ip);
});
}
void loop() {
// Code for periodically sending and receiving data
}