Quantity | 3+ units | 10+ units | 30+ units | 50+ units | More |
---|---|---|---|---|---|
Price /Unit | $11.75 | $11.51 | $11.15 | $10.67 | Contact US |
Upgrade Ethernet W5100 Shield For Arduino ADK UNO Mega 2560 1280 328 Mini SD
Description:
- The Arduino Ethernet W5100 network expansion module allows the Arduino to a simple Web server, or network applications through the network to control the read and write Arduino digital and analog interfaces. Ethernet library files can be used directly in the IDE can implement a simple Web server.
- While supported by the version of the mini SD card (TF card) reader
- The expansion board uses a stackable design, can be directly plugged into the Arduino, and other expansion boards can also be plugged in to.
Code:
/ *
* Web Server
*
* A simple web-server that shows the value of the analog input pins,
* /
# Include
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 the 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 that we can not the send a reply
if (c == '\ n' && current_line_is_blank) {
/ / Send a standard http the response the header
client.println ("HTTP/1.1 200 OK");
client.println ("Content-Type: text / html");
client.println ();
/ / The output the value of each analog input pin
client.print ("welcome to tinyos");
client.println (
");
client.print ("/ / *************************************");
client.println (
");
client.print (tinyos.net.cn);
client.println (
");
client.print ("/ / *************************************");
client.println (
");
for (int i = 0; i <6; i + +) {
client.print ("analog input");
client.print (i);
client.print ("is");
client.print (analogRead (i));
client.println (
");
}
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 ();
}
}