Creating a web server on Arduino
For the rest of this chapter, we are going to take another approach. We are still going to make the Arduino with the Ethernet Shield work as an independent system, but this time we are even going to create a web server on the Arduino board. This is actually similar to the project we saw in the Chapter 2, Sending Data to a Web Server, but this time it is the Arduino board itself that will display the data as it is measured.
The sketch for this part starts by including the right libraries, as shown in the following code:
#include "DHT.h" #include <Ethernet.h> #include <SPI.h>
Define the pin and the type of the sensor in the following manner:
#define DHTPIN 7 #define DHTTYPE DHT11
Also, you have to define the MAC address of your Ethernet shield as usual, as shown in the following line of code:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xFE, 0x40 };
We will also define a default IP address in case the DHCP fails, as shown in the following line:
IPAddress...