Hello, everyone!
Today we finished porting the uIP stack to our Arduino core.
This works well with the ENC28J60 ethernet shild.
Ethernet shilds based on WizNet chips will be supported soon when they are available for us.
This port has not yet appeared in the main github thread, but given the importance of this event, we decided to announce it here.
To take advantage of the new functionality you need to do two things on your own.
1)Place the contents of this archive in libraries
for Windows users, the route might be something like this:
C:\Users\<username>\AppData\Local\Arduino15\packages\w80x_duino\hardware\XT804\0.0.6\libraries
2) Place the contents of this archive in w806 folder
path for example:
C:\Users\<username>\AppData\Local\Arduino15\packages\w80x_duino\hardware\XT804\0.0.6\cores\w806
For Linux users, the steps are the same. Usually the required folders are located in the home directory
ping test
For budding Arduino enthusiasts and students, we highly recommend learning this material and sharing your successes and possibly failures with us :)
https://startingelectronics.org/tutorials/arduino/ethernet-shield-web-server-tutorial/
Standard connection:
CS -> PB14
SI -> PB17
SO -> PB16
SCK -> PB15
GND -> GND
VCC -> 3.3V !!!!!
Sheld:
Test sketch
#include <Arduino.h>
#include <UIPEthernet.h>
#define MACADDRESS 0x00,0x01,0x02,0x03,0x04,0x05
#define MYIPADDR 192,168,100,16
#define MYIPMASK 255,255,255,0
#define MYDNS 192,168,100,1
#define MYGW 192,168,100,1
#define LISTENPORT 80
EthernetServer server = EthernetServer(LISTENPORT);
void setup()
{
uint8_t mac[6] = {MACADDRESS};
uint8_t myIP[4] = {MYIPADDR};
uint8_t myMASK[4] = {MYIPMASK};
uint8_t myDNS[4] = {MYDNS};
uint8_t myGW[4] = {MYGW};
Ethernet.begin(mac,myIP,myDNS,myGW,myMASK);
server.begin();
}
void loop()
{
EthernetClient client = server.available(); // try to get client
if (client) { // got client?
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) { // client data available to read
char c = client.read(); // read 1 byte (character) from client
// last line of client request is blank and ends with \n
// respond to client only after last line received
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
// send web page
client.println("<!DOCTYPE html>");
client.println("<html>");
client.println("<head>");
client.println("<title>Arduino Web Page</title>");
client.println("</head>");
client.println("<body>");
client.println("<h1>Hello from Arduino!</h1>");
client.println("<p>A web page from the Arduino server</p>");
client.println("</body>");
client.println("</html>");
break;
}
// every line of text received from the client ends with \r\n
if (c == '\n') {
// last character on line of received text
// starting new line with next character read
currentLineIsBlank = true;
}
else if (c != '\r') {
// a text character was received from client
currentLineIsBlank = false;
}
} // end if (client.available())
} // end while (client.connected())
delay(1); // give the web browser time to receive the data
client.stop(); // close the connection
} // end if (client)
}
Result