Microduino W5500 Network (3)
PurposeThe course will show you how to send data to one website and receive returned data of the website. Equipment
Schematic
Stack them and then plug in cable. As follows: ProgramDebuggingStep 1: First, make sure you have _02_Microduino_Ethernet_WIZ library in your IDE and put it into libraries folder of your IDE. Step 2: If there still exists the previous Ethernet library in your libraries folder, it needs to be deleted since the previous Ethernet is compiled according to W5100.
First find w5100.h of utility in _02_Microduino_Ethernet_WIZ library. Change #define wiz_cs_pin 8 //CS_PIN of the code to #define wiz_cs_pin 10 //CS_PIN. Step 3: Interpret the code: Here is a simple php webpage. http://www.lucadentella.it/demo/aphorisms.php Each time you open the link, it will return you a maxim. The code we complied can get these maxims and output to serial port. // if you get a connection, report back via serial: if (client.connect(server, 80)) { Serial.println("connected"); // Make a HTTP request: client.println("GET /demo/aphorisms.php HTTP/1.1"); client.println("Host: www.lucadentella.it"); client.println("Connection: close"); client.println(); } else { // if you didn't get a connection to the server: Serial.println("connection failed"); } First, visit this page in the code. // if there are incoming bytes available // from the server, read them and print them: if (client.available()) { char c = client.read(); Serial.print(c); } Output the returned info. to serial port and when failed to visit, you’ll see notice in the serial port Step 3: Download code and pass compile. Step 4: Watch the serial port. ResultIf everything goes well, you’ll see the information below: It will show a maxim randomly and then close. Video |