Cant compile the code

Hello Guys

i was setting alarms in my arduino using ds1307rtc but seems like i was not able to compile it

Here is my sketch

/*

#include <Time.h>
#include <TimeAlarms.h>
#include <Wire.h> //added jim ************************
#include <DS1307RTC.h> //added jim ***************************

void setup()
{
  Serial.begin(9600);
  Serial.println("In setup...."); //added jim *****************
  /*
  using rtc, sync system time to rtc
   setTime(8,29,0,1,1,11); // set time to Saturday 8:29:00am Jan 1 2011 //old way *****************
   */

  // following lines added to set time from rtc, took from timeRtcSet example, added jim *****************
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if (timeStatus() != timeSet) 
    Serial.println("Unable to sync with the RTC");
  else
    Serial.println("RTC has set the system time");
  // end of setting the time ******************************



  // create the alarms 
   Alarm.alarmRepeat(11, 30, 30,led13OFF);
  Alarm.alarmRepeat(11, 30, 00,led13ON);
 
  //Alarm.alarmRepeat(11,16,0, MorningAlarm); 
 /* 
  Alarm.alarmRepeat(10, 35,45, MorningAlarm);  
  Alarm.alarmRepeat(10,36,0, MorningAlarm); 
 
  Alarm.alarmRepeat(10, 36,30, MorningAlarm);
  
  Alarm.alarmRepeat(10,37,0, MorningAlarm);  
  
  Alarm.alarmRepeat(10, 15,30, MorningAlarm);
  Alarm.alarmRepeat(10,16,0, MorningAlarm);  
  Alarm.alarmRepeat(10,16,30, MorningAlarm);  
  Alarm.alarmRepeat(10,17,0, MorningAlarm);  
  Alarm.alarmRepeat(10, 17,30, MorningAlarm);
  Alarm.alarmRepeat(17,45,0,EveningAlarm);  // 5:45pm every day 
  Alarm.alarmRepeat(dowSaturday,8,30,30,WeeklyAlarm);  // 8:30:30 every Saturday 
  */


  //Alarm.timerRepeat(15, Repeats);            // timer for every 15 seconds    
  //Alarm.timerOnce(10, OnceOnly);             // called once after 10 seconds 


  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  Serial.print("Turning pin 13 LED off at ");
  digitalClockDisplay();
  Serial.println("Ending setup...."); //added jim *****************
}

void  loop(){  
  digitalClockDisplay();
  Alarm.delay(1000);
}

// functions to be called when an alarm triggers:

void led13ON(){
 //Serial.print("Turning pin 13 LED on at ");
 //digitalClockDisplay();
 digitalWrite(13, HIGH);   
 }
 
 void led13OFF(){
 //Serial.print("Turning pin 13 LED off at ");
 //digitalClockDisplay();
 digitalWrite(13, LOW);   
 }
 

void MorningAlarm(){
  digitalClockDisplay();
  Serial.println("Alarm: - turn lights off Jimbo");    
}

void EveningAlarm(){
  Serial.println("Alarm: - turn lights on");           
}

void WeeklyAlarm(){
  Serial.println("Alarm: - its Monday Morning");      
}

void ExplicitAlarm(){
  Serial.println("Alarm: - this triggers only at the given date and time");       
}

void Repeats(){
  Serial.println("15 second timer");         
}

void OnceOnly(){
  Serial.println("This timer only triggers once");  
}

void digitalClockDisplay()
{
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.println(); 
}

void printDigits(int digits)
{
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

Here is the error

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
In file included from sketch_may08a.ino:13:
C:\Users\saif\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:17: error: 'time_t' does not name a type
C:\Users\saif\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:18: error: 'time_t' has not been declared
C:\Users\saif\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:19: error: 'tmElements_t' has not been declared
C:\Users\saif\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:20: error: 'tmElements_t' has not been declared
sketch_may08a.ino: In function 'void setup()':
sketch_may08a:25: error: 'class DS1307RTC' has no member named 'get'
sketch_may08a:25: error: 'setSyncProvider' was not declared in this scope
sketch_may08a:26: error: 'timeStatus' was not declared in this scope
sketch_may08a:26: error: 'timeSet' was not declared in this scope
sketch_may08a:35: error: 'Alarm' was not declared in this scope
sketch_may08a.ino: In function 'void loop()':
sketch_may08a:70: error: 'Alarm' was not declared in this scope
sketch_may08a.ino: In function 'void digitalClockDisplay()':
sketch_may08a:116: error: 'hour' was not declared in this scope
sketch_may08a:117: error: 'minute' was not declared in this scope
sketch_may08a:118: error: 'second' was not declared in this scope

can u guys pls point me out what might be the problem

That first line looks awfully suspicious. I suggest removing it.

/*  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

#include <Time.h>
#include <TimeAlarms.h>
#include <Wire.h> //added jim ************************
#include <DS1307RTC.h> //added jim ***************************

void setup()
{
...

sorry
Its mistaken but a still the erro persist

saifkazi: Its mistaken but a still the erro persist

The code you posted is not the code you are trying to compile? That will make it rather difficult to help you.

Hi,

I’m not sure you understood about the first line, we mean delete this line completely.

/*  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

What it is saying is that after /* all the text will be treated as comments until */ or // is encountered.

Tom… :slight_smile:

SOLVED updated to latetst arduino ide with library manager

Hi, Interesting, it won't compile on 1.5.5 but will on 1.6.3.

Tom..... :)