Tutorial.WebServer History

Hide minor edits - Show changes to markup

August 08, 2013, at 07:02 PM by Scott Fitzgerald -
Changed line 39 from:
to:
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:
to:
November 28, 2011, at 04:30 PM by Scott Fitzgerald -
Changed line 39 from:
to:
November 16, 2011, at 05:16 AM by Scott Fitzgerald -
Changed line 39 from:
to:
November 16, 2011, at 05:11 AM by Scott Fitzgerald -
Changed line 39 from:
to:
November 16, 2011, at 04:28 AM by Scott Fitzgerald -
Changed line 39 from:
to:
September 23, 2010, at 05:09 AM by Christian Cerrito -
Changed lines 44-46 from:
to:
September 17, 2010, at 04:32 PM by Tom Igoe -
Changed lines 51-52 from:
to:
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

to:
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

Share