Need help with a timer

Hi all! I picked up a 4 channel relay board and have been playing around with it lately. I have an arduino uno and got everything wired up, and was able to flash a 120v ac light bulb. Then i stumbled across using your keyboard to turn it on and off.. cool! i was really excited. Now im wanting to actually use this thing and make a timer to control 2(for now) 120v ac plug ins--water pump and lights for my aquaponics system. I have been at this all day, and am slowly removing compiling errors. Unfortunately, I have zero-to-none knowledge in the programming field, and im jumping in to something pretty big here, i know that. I need the light on for x amount of hours and water pump to turn on for 15 mins, off for 15, on for 15 and so on..
Here is what i haved cooked up.

#include <Time.h>
#include <DateTime.h>
#include <TimeAlarms.h>
#define RELAY_PIN 13

 
AlarmID_t myTimer;
 
 
 
void OnTimer(AlarmID_t Sender){
  // add code here to execute when the timer triggers
    Serial.println("timer triggered");
    pinMode(RELAY_PIN, OUTPUT);
    Serial.begin(9600); // open serial
  
   //Change the time to the current time (else will default to 01/01/2009)
        DateTime newLocalTime = new DateTime(2012,8,12,20,04,00);
        Utility.SetLocalTime(newLocalTime);
 
        /*Creates a timer that calls the OnTimer method immediately after creation
         and then calls it every 900000 milliseconds (15 minutes or every 900 seconds)*/
        System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(OnTimer), null, 0, 900000);
        Thread.Sleep(Timeout.Infinite);
 
    
}
void setup(){
 
  Serial.begin(9600);  
  pinMode(13,OUTPUT); // we will flash the LED on and off each second in loop
 
}
void loop(){


{
  myTimer = dtAlarms.createTimer( AlarmHMS(0, 5, 0), &OnTimer); // create a timer with period: 0 hrs, 5 minutes, 0 seconds
  DateTime.sync(0);   // Start the clock  

}
 
  dtAlarms.delay(1000);  // call dtAlarms.delay instead of delay so the alarms can be serviced
  digitalWrite(13,HIGH);
  dtAlarms.delay(1000);
  digitalWrite(13,LOW);
 }
 
}

}

And this is what it threw back at me..

jay.cpp: In function 'void OnTimer(AlarmID_t)':
jay:17: error: expected `;' before 'newLocalTime'
jay:18: error: 'Utility' was not declared in this scope
jay:18: error: 'newLocalTime' was not declared in this scope
jay:22: error: 'System' was not declared in this scope
jay:22: error: expected `;' before 'timer'
jay:23: error: 'Thread' was not declared in this scope
jay:23: error: 'Timeout' was not declared in this scope
jay.cpp: In function 'void loop()':
jay:37: error: 'dtAlarms' was not declared in this scope
jay:42: error: 'dtAlarms' was not declared in this scope
jay.cpp: At global scope:
jay:48: error: expected declaration before '}' token

What a first impression to make for you guys :wink:
Thanks a lot, and any help will be greatly appreciated!!

Also note that im only trying to control one relay at this time.

Most of those errors are because you didn't initialize the classes you are using.

Utility, System, Thread, Timeout, dtAlarms, etc... haven't been initialized.

void OnTimer(AlarmID_t Sender){
  // add code here to execute when the timer triggers
    Serial.println("timer triggered");
    pinMode(RELAY_PIN, OUTPUT);
    Serial.begin(9600); // open serial

This won't be the reason for your errors, but I wouldn't be doing a Serial.begin here, especially after a Serial.println. That should be in setup, and only there.

That certainly does not look like Arduino code. It looks a lot more like Windows code. I think you are going about this project all wrong.

Can anybody help me get this going in the right direction? I dont want it completed by somebody. I want to figure it out. But i do need at least a little help? Anybody?

I think to get you started in the right direction you need to look at the sample sketch "blink without delay" and read the article by Majenko about finite state machines.

http://hacking.majenko.co.uk/finite-state-machine