Html Scheduling Function

I am working on a home light control using a arduino uno and ethernet shield. I have successfully managed to turn on and off the lights in my house on a webpage generated by the arduino and using the boards and some relays. So turning on and off the lights remotely is not the problem but I would like to add a schedule function (if possible) so that on the webpage it will come up with select a time, maybe even a date and I can tell it when to turn on and off the lights (or certain pins), while still having the ability to select a on or off button on the site. I'm not sure if the arduino uno itself is capable of this function or if I have to add in another device to help out with this function. Any thoughts?

Post your code Read this before posting a programming question ...

Sorry, here is the code I have been working with, in which I have received the basic sketch from a guy on here and modified it a little bit.

#include <SPI.h>
#include <Ethernet.h>

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xD7, 0xD8 }; //physical mac address
byte ip[] = { 192, 168, 2, 8 }; // ip in lan
byte gateway[] = { 192, 168, 2, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString; 


void setup(){

  pinMode(5, OUTPUT);
 pinMode(6, OUTPUT); //pins selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);

  //enable serial data print 


void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c =;

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 

        //if HTTP request has ended
        if (c == '\n') {

          Serial.println(readString); //print to serial monitor for debuging 

          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");

          client.println("<TITLE>Home Lighting Control</TITLE>");
          client.println("<H1>2 Channel Lighting Control</H1>");
          client.println("<p><a href=><input type='submit' value='Return To Your Account'></a></p>");
          client.println("<a href=\"/?1on\"><input type='submit' value='Station 1 On'></a>"); 
          client.println("<a href=\"/?1off\"><input type='submit' value='Station 1 OFF'></a>"); 
          client.println("<p><a href=\"/?2on\"><input type='submit' value='Station 2 ON'></a>"); 
          client.println("<a href=\"/?2off\"><input type='submit' value='Station 2 OFF'></a></p>");

          //stopping client

          ///////////////////// control arduino pin
          if(readString.indexOf("1on") >0)//checks for on
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led On");
          if(readString.indexOf("1off") >0)//checks for off
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led Off");
           if(readString.indexOf("2on") >0)//checks for on
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("Led On");
          if(readString.indexOf("2off") >0)//checks for off
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println("Led Off");
          //clearing string for next read


You probably want to look at a real-time-clock (RTC) chip.

The ds1307 is popular. It works fine when powered, but I found them to lose track of time when run on battery backup.

My favorite is the DS3231 because it is very very stable.

Both work with the Arduino Time library, which will keep track of time without a RTC. It just won't be as accurate and, obviously, not remember what time it is when the board is reset (or power cycled.)

Now that you're starting to develop more complex functions, it might be a good time to put your management logic on a PC and just use the Arduno as an I/O device. You can use the existing web service for communication from the PC to the Arduino, if you want.