Tutorial.WebServer History

Hide minor edits - Show changes to output

August 08, 2013, at 07:02 PM by Scott Fitzgerald -
Changed line 39 from:
(:source http://raw.github.com/arduino/Arduino/ide-1.5.x/hardware/arduino/avr/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.github.com/arduino/Arduino/master/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
Deleted line 45:
February 12, 2013, at 12:55 PM by Roberto Guido - updated reference to example code. Thanks Joseph LaPorte for report
Changed line 39 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
to:
(:source http://raw.github.com/arduino/Arduino/ide-1.5.x/hardware/arduino/avr/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
November 28, 2011, at 04:30 PM by Scott Fitzgerald -
Changed line 39 from:
(:source http://arduino.cc/en/pub/code/0023/libraries/Ethernet/examples/WebServer/WebServer.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
November 16, 2011, at 05:16 AM by Scott Fitzgerald -
Changed line 39 from:
(:source http://arduino.cc/en/pub/code/023/libraries/Ethernet/examples/WebServer/WebServer.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/0023/libraries/Ethernet/examples/WebServer/WebServer.pde lang=arduino tabwidth=4:)
November 16, 2011, at 05:11 AM by Scott Fitzgerald -
Changed line 39 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/023/libraries/Ethernet/examples/WebServer/WebServer.pde lang=arduino tabwidth=4:)
November 16, 2011, at 04:28 AM by Scott Fitzgerald -
Changed line 39 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Ethernet/examples/WebServer/WebServer.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Ethernet/examples/WebServer/WebServer.ino lang=arduino tabwidth=4:)
September 23, 2010, at 05:09 AM by Christian Cerrito -
Changed lines 44-46 from:
(:include EthernetSeeAlsoIncludes :)
to:
(:include EthernetSeeAlsoIncludes :)

September 17, 2010, at 04:36 PM by Tom Igoe -
Changed lines 44-53 from:
* [[Main/ArduinoEthernetShield | Arduino Ethernet Shield]]
* [[Guide/ArduinoEthernetShield | Getting started with the ethernet shield]]
* [[Reference/Ethernet | Ethernet library]]
* [[ChatServer]]
* [[WebClient]]
* [[WebServer]]
* [[PachubeCient]]
* [[BarometricPressureWebServer]]
* [[UDPSendReceiveString]]
* [[UdpNtpClient]]
to:
(:include EthernetSeeAlsoIncludes :)
September 17, 2010, at 04:32 PM by Tom Igoe -
Changed lines 51-52 from:
* [[TwitterClient]]
*[[BarometricPressureWebServer]]
to:
* [[BarometricPressureWebServer]]
* [[UDPSendReceiveString]]
* [[UdpNtpClient]]
August 15, 2010, at 02:52 PM by Tom Igoe -
Changed line 31 from:
!!!Schematic
to:
!!!Schematic
August 15, 2010, at 06:05 AM by Christian Cerrito -
Changed lines 5-6 from:
In this example, you will use your Ethernet Shield and your Arduino to create a simple Web server. Using the Ethernet library, your device will be able to answer a HTTP request using your Ethernet shield. After opening a browser and navigating to your Ethernet shield's IP address, your Arduino will respond with just enough HTML for a browser to display the input values from all six analog pins.
to:
In this example, you will use your Ethernet Shield and your Arduino to create a simple Web server. Using the Ethernet library, your device will be able to answer a HTTP request with your Ethernet shield. After opening a browser and navigating to your Ethernet shield's IP address, your Arduino will respond with just enough HTML for a browser to display the input values from all six analog pins.
August 15, 2010, at 05:57 AM by Christian Cerrito -
Changed lines 5-6 from:
This example is a simple Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's IP address, it responds with just enough HTML for a browser to display the input values from all six analog pins.
to:
In this example, you will use your Ethernet Shield and your Arduino to create a simple Web server. Using the Ethernet library, your device will be able to answer a HTTP request using your Ethernet shield. After opening a browser and navigating to your Ethernet shield's IP address, your Arduino will respond with just enough HTML for a browser to display the input values from all six analog pins.
August 15, 2010, at 05:53 AM by Christian Cerrito -
Changed lines 5-6 from:
This example is a simople Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's IP address, it responds with just enough HTML for a browser to display the input values from all six analog pins.
to:
This example is a simple Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's IP address, it responds with just enough HTML for a browser to display the input values from all six analog pins.
August 15, 2010, at 04:16 AM by Christian Cerrito -
Changed lines 5-6 from:
This example is a simople Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's address, it responds with just enough HTML for a browser to display the input values from all six analog pins.
to:
This example is a simople Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's IP address, it responds with just enough HTML for a browser to display the input values from all six analog pins.
August 15, 2010, at 04:15 AM by Christian Cerrito -
Changed lines 27-28 from:
'''''In the above image, your Arduino would be connected below the Ethernet shield.'''''
to:
'''''In the above image, your Arduino would be stacked below the Ethernet shield.'''''
August 15, 2010, at 04:14 AM by Christian Cerrito -
Changed line 36 from:
Describe what's going on here
to:
!!!Code
August 15, 2010, at 04:14 AM by Christian Cerrito -
Changed lines 5-6 from:
This example is a simople Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's address, it responds with just enough HTML for a browser to display the readings from the analog input values.
to:
This example is a simople Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's address, it responds with just enough HTML for a browser to display the input values from all six analog pins.
Added line 11:
August 15, 2010, at 01:52 AM by Christian Cerrito -
Added lines 18-21:
The shield should be connected to a network with an ethernet cable. You will need to change the network settings in the program to correspond to your network.


August 15, 2010, at 01:51 AM by Christian Cerrito -
Added lines 22-23:
'''''In the above image, your Arduino would be connected below the Ethernet shield.'''''
August 13, 2010, at 03:51 PM by Tom Igoe -
Changed lines 1-71 from:
''Examples > Ethernet library''

!!Web Server

A web server that provides the values of the analog inputs. This works with the Arduino Ethernet shield. To use simply, use a web browser to go to the shield's IP address.

!!!!Code

[@
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };

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
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;
}
}
}
// give the web browser time to receive the data
delay(1);
client.stop();
}
}
@]

!!!!See also

* [[Reference/Ethernet | Ethernet library reference]]
* [[Guide/ArduinoEthernetShield | Ethernet shield guide]]
* [[Main/ArduinoEthernetShield | Ethernet shield data sheet]]
to:
''Examples > Ethernet Library''

!!!Web Server

This example is a simople Web server. It shows you how to answer a HTTP request using an Ethernet shield. When you open a browser and go to your Ethernet shield's address, it responds with just enough HTML for a browser to display the readings from the analog input values.

(:div class=BOM :)
!!!Hardware Required
* Arduino Ethernet Shield
* Shield-compatible Arduino board
(:divend:)

!!!Circuit
(:div class=circuit :)

The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino via the SPI bus. It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet. Later models of the Ethernet shield also have an SD Card on board. Digital pin 4 is used to control the slave select pin on the SD card.

%height=300px%[[Attach:EthernetShield_bb.png | Attach:EthernetShield_bb.png]]

[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]

(:divend:)

!!!Schematic
(:div class=circuit :)
%height=300px%[[Attach:EthernetShield_sch.png | Attach:EthernetShield_sch.png]]
(:divend:)

Describe what's going on here

(:div class=code :)
(:source http://arduino.cc/en/pub/code/master/libraries/Ethernet/examples/WebServer/WebServer.pde lang=arduino tabwidth=4:)
(:divend:)


!!!See Also:
* [[Main/ArduinoEthernetShield | Arduino Ethernet Shield]]
* [[Guide/ArduinoEthernetShield | Getting started with the ethernet shield]]
* [[Reference/Ethernet | Ethernet library]]
* [[ChatServer]]
* [[WebClient]]
* [[WebServer]]
* [[PachubeCient]]
* [[TwitterClient]]
*[[BarometricPressureWebServer]]
December 14, 2008, at 06:56 PM by David A. Mellis -
Changed lines 5-6 from:
A web server that provides the values of the analog inputs. To use simply, use a web browser to go to the shield's IP address.
to:
A web server that provides the values of the analog inputs. This works with the Arduino Ethernet shield. To use simply, use a web browser to go to the shield's IP address.
December 14, 2008, at 06:56 PM by David A. Mellis -
Added lines 1-71:
''Examples > Ethernet library''

!!Web Server

A web server that provides the values of the analog inputs. To use simply, use a web browser to go to the shield's IP address.

!!!!Code

[@
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };

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
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;
}
}
}
// give the web browser time to receive the data
delay(1);
client.stop();
}
}
@]

!!!!See also

* [[Reference/Ethernet | Ethernet library reference]]
* [[Guide/ArduinoEthernetShield | Ethernet shield guide]]
* [[Main/ArduinoEthernetShield | Ethernet shield data sheet]]

Share