Arduino W5100 Demo Test

Posted by: Chao Category: Network Tags: , , , Comments: 3

Arduino W5100 Demo Test

1. Stack your W5100 shield on you arduino board,make sure all the pins contact OK.

plug the w5100 into arduino

SIZE:   L-69MM    W-53.6MM

2. Download the test sketch

5100 download sketch

[c]

/************************************************/
#include <SPI.h>
/*
* Web Server
*
* A simple web server that shows the value of the analog input pins.
*/
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 15 };
Server server(80);
void setup()
{
Ethernet.begin(mac, ip);
server.begin();
}
void loop()
{
Client client = server.available();
if (client) {
// an http request ends with a blank line
boolean current_line_is_blank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// if we’ve gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so we can send a reply
if (c == ‘n’ && current_line_is_blank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

// output the value of each analog input pin
client.print("welcome to tinyos electronics");
client.println("<br />");
client.print("//*************************************");
client.println("<br />");
client.print("");
client.println("<br />");
client.print("//*************************************");
client.println("<br />");
for (int i = 0; i < 6; i++) {
client.print("analog input ");
client.print(i);
client.print(" is ");
client.print(analogRead(i));
client.println("<br />");
}
break;
}
if (c == ‘n’) {
// we’re starting a new line
current_line_is_blank = true;
} else if (c != ‘r’) {
// we’ve gotten a character on the current line
current_line_is_blank = false;
}
}
}
client.stop();
}
}
[/c]

3. Connect your W5100 board and PC with cable(you may need a crossover cable if you direct connect PC and W5100)

w5100 to PC

 

4. Setting your local PC IP

IP 地址 = IP address; 子网掩码 = subnet mask; 默认网关 = default net gate.

set IP for w5100

5.You will see PC Local connection show connected and W5100 4 LEDS will turn ON

FULLD,100M,LINK,PWR

reset w5100

If not please try to press RESET button on W5100 Shield.

5.Now you can PING the W5100

w5100

6.Visit http://192.168.0.15/ you can see the test web page

visit webpage 5100

Share this post

Comments (3)

  • poulbran Reply

    It looks a lot cleaner and more up to date than an old one.

    September 12, 2016 at 8:54 am
  • Abu M. Muttalib Reply

    it helped me. Thanks.

    it worked with normal cable connected directly between pc and board.

    why did it not work while both cables connected to router; no idea. Any help?

    March 12, 2017 at 1:05 am
  • Chao Reply

    Sorry don’t understand the question, do you mean two modules connect by two cables to the router?

    If you use fixed IP address, it can be IP conflict? Try different one?

    March 12, 2017 at 11:56 am

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.


%d bloggers like this: