Example Code for Arduino-WebServer
Last revision 2025/12/17
This instruction shows you how to use DFRobot W5200 Ethernet Shield in Arduino IDE, taking UNO as an example.
Hardware Preparation
- DFRduino UNO R3 (SKU:DFR0216)x 1
- Ethernet Shield for Arduino (SKU:DFR0272)x1
- USB Cable for Arduino UNO/Mega (SKU:FIT0056)x1
- Ethernet Cable x1
Hardware Connection
- Plug W5200 shield onto Arduino UNO board.
- Use a Ethernet cable to connect W5200 Shield's RJ45 port to a computer's Ethernet interface or router's LAN port that is in same local network.
- Connect UNO board with the computer via a USB cable.
Software Preparation
- Download Ethernet library: Ethernet library
WebServer Sample Revising
Find and open the unzipped files sample program "WebServer.ino".

- Open "WebServer.ino" in Arduino IDE, and add code in the program to define the IO connection between W5200 shield and UNO (For other mainboards, please revise according to actual IO connection), create a W5200 shield init function "DF_W5200_Init" and place it in setup for calling.
#define W5200_nSCS 10
#define W5200_nRST 8
#define W5200_PWDN 9
#define W5200_nINT 3 //unused
void DF_W5200_Init(void)
{
pinMode(W5200_nSCS,OUTPUT);
pinMode(W5200_nRST,OUTPUT);
pinMode(W5200_PWDN,OUTPUT);
pinMode(W5200_nINT,INPUT); //unused
digitalWrite(W5200_PWDN,LOW); //Normal Mode Enable
digitalWrite(W5200_nRST,LOW); //Hardware reset
delay(10);
digitalWrite(W5200_nRST,HIGH);
delay(200);
Ethernet.init(W5200_nSCS);
}
- Revise IP address (please make sure that the modified IP address is in the same network segment as the computer and is not occupied by other devices.). For example, set W5200 shield IP as: 20.20.1.177, then the codes should be revised as below:

- Burn the program to UNO.
Test and Check
Open a browser and enter the IP address set for w5200 in Arduino code.

Was this article helpful?
