I could not able to blink led 4 . How can change local date , time on web server.
#include <SPI.h>
#include <Ethernet.h>
String readString;
int led = 4;
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,7, 150);
EthernetServer server(80);
int local_day=12;
int local_month=04;
int local_year=2014;
int local_h=12;
int local_m=30;
int local_s=21;
float latitude=15.08;
float longitude=58.05;
float tracker_des_angle=45.0;
float tracker_actual_pos=43.0;
int Wind_Speed=12;
int Wind_Kmph=120;
void setup()
{
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop()
{
Ethernet_webserver();
}
void Ethernet_webserver()
{
EthernetClient client = server.available();
if (client)
{
boolean currentLineIsBlank = true;
while (client.connected())
{
if (client.available())
{
char c = client.read();
if (c == '\n' && currentLineIsBlank)
{
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connnection: close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
client.println("<TITLE>NAVYA TITLE </TITLE>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<H1>NAVYA TITLE </H1>");
client.println("<hr />");
client.println("
");
client.println("<H2>NAVYA TRACKER PROJECT </H2>");
client.println("
");
client.println("<a href=\"/?button1on\"\">Turn On LED</a>");
client.println("<a href=\"/?button1off\"\">Turn Off LED</a>
");
client.println("
");
client.println("
");
/*
client.println("<!DOCTYPE HTML>");
client.println("<html>");*/
// add a meta refresh tag, so the browser pulls again every 5 seconds:
// client.println("<meta http-equiv=\"refresh\" content=\"5\">");
// add sententence here
client.print("LOCAL DATE :");
client.print(local_day);
client.print("/");
client.print(local_month);
client.print("/");
client.print(local_year);
client.println("
");
client.print("LOCAL TIME :");
client.print(local_h);
client.print("/");
client.print(local_m);
client.print("/");
client.print(local_s);
client.println("
");
client.print("LATITUDE :");
client.print(latitude);
client.print("
");
client.print("LONGITUDE :");
client.print(longitude);
client.println("
");
client.print("DESIRED ANGLE:");
client.print(tracker_des_angle);
client.println("
");
client.print("ACTUAL ANGLE:");
client.print(tracker_actual_pos);
client.println("
");
client.print("WIND SPEED M/S:");
client.print(Wind_Speed);
client.println("
");
client.print("WIND SPEED KMPH:");
client.print(Wind_Kmph);
client.println("
");
client.println("</html>");
//break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
if (readString.indexOf("?button1on") >0){
digitalWrite(led, HIGH);
}
if (readString.indexOf("?button1off") >0){
digitalWrite(led, LOW);
}
readString="";
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}