error: 'millis' was not declared in this scope

Hello everybody,

I am new in arduino and I am trying to build an aquarium controller. I am trying now to make actions with relays at certain time using an RTC, I am using as RTC a DS1302 but I can’t find any example in order to modifie it for my needs so i decide to use a DS1307, while I am trying to make it work for me using this example:

#include <Wire.h>
#include "RTClib.h"
#include <Time.h>
#include <TimeAlarms.h>

RTC_DS1307 RTC;


// RELAYS

int pumprelay = 3;
int filterrelay = 4;
int lightsrelay = 5;
int heaterrelay = 6;

//BUTTONS

int FeedingButton = 7;
int HeaterButton = 18;

//LEDS

int lightsled = 8;
int pumpled = 9;
int filterled = 10;
int FeedingLED = 11;
int heaterled = 12;


// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

// the setup routine runs once when you press reset:
void setup() {
    Serial.begin(9600); 
    Wire.begin();
    RTC.begin();
 
  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    
  }
  
  // initialize the digital pin as an output.
  pinMode(lightsrelay, OUTPUT); 
  pinMode(lightsled, OUTPUT);    
  pinMode(heaterrelay, OUTPUT); 
  pinMode(heaterled, OUTPUT);   
  pinMode(pumprelay, OUTPUT); 
  pinMode(pumpled, OUTPUT);  
  pinMode(filterrelay, OUTPUT); 
  pinMode(filterled, OUTPUT);    
  pinMode(FeedingButton, INPUT); 
  pinMode(FeedingLED, OUTPUT);
  Serial.println("Startup Completed");  
  FilterOn();
    Alarm.alarmRepeat(23,00,0, Night);  // 8:30am every day
    Alarm.alarmRepeat(06,00,0, Day);  // 8:30am every day
    Alarm.alarmRepeat(21,55,30, Feeding);  // 8:30am every day
}

// the loop routine runs over and over again forever:
void loop() {
 
  DateTime now = RTC.now();
 
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

  
    // read the state of the pushbutton value:
  buttonState = digitalRead(FeedingButton);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // Start Feeding Cyle    
      Feeding();
  } 
  else {
    // Continue Normal Program

 }
 
 Alarm.delay(1000); // wait one second between clock display
}

void Feeding() {
   digitalWrite(FeedingLED, HIGH); // Set Feeding LED On
     Serial.println("Feeding Cycle Started");  
  LightsOn();
  PumpOff();
  FilterOff();
  delay(6000);
  digitalWrite(FeedingLED, LOW); // Set Feeding LED Off
    Serial.println("Feeding Cycle Ended");  
  LightsOff();
  PumpOn();
  FilterOn();
  delay(6000);

}

void Night () {
  LightsOff();
  PumpOff();
}

void Day () {
  LightsOn();
  PumpOn();
}

void LightsOn() {
 digitalWrite(lightsrelay, HIGH); // Set Lights On
 digitalWrite(lightsled, HIGH); // Set LED On
   Serial.println("Lights On");  
}

void LightsOff() {
 digitalWrite(lightsrelay, LOW); // Set Lights Off
 digitalWrite(lightsled, LOW); // Set LED Off
   Serial.println("Lights Off");  
}

void PumpOn() {
 digitalWrite(pumprelay, HIGH); // Set Pump On
 digitalWrite(pumpled, HIGH); // Set LED On
   Serial.println("Pump On");  
}

void PumpOff() {
 digitalWrite(pumprelay, LOW); // Set Pump Off
 digitalWrite(pumpled, LOW); // Set LED Off
   Serial.println("Pump Off");  
}

void FilterOn() {
 digitalWrite(filterrelay, HIGH); // Set Filter On
 digitalWrite(filterled, HIGH); // Set LED On
   Serial.println("Filter On");  
}

void FilterOff() {
 digitalWrite(filterrelay, LOW); // Set Filter Off
 digitalWrite(filterled, LOW); // Set LED Off
   Serial.println("Filter Off");  
}

I am getting this error message:
C:\Program Files (x86)\Arduino\libraries\Time\Time.cpp: In function ‘time_t now()’:
C:\Program Files (x86)\Arduino\libraries\Time\Time.cpp:240: error: ‘millis’ was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Time\Time.cpp: In function ‘void setTime(time_t)’:
C:\Program Files (x86)\Arduino\libraries\Time\Time.cpp:268: error: ‘millis’ was not declared in this scope

please is there anybody who can help me???

please is there anybody who can help me???

Perhaps after you get you ? key to stop sticking.

What version of the Time library are you using? Is it a post-1.0 compatible version?

(Notice how it IS possible to use just one ?)

If you are using this Time library (Arduino Playground - HomePage) it is out of date.

joshuabardwell:
If you are using this Time library (Arduino Playground - HomePage) it is out of date.

Can you give me a link for a newer time library???

Can you give me a link for a newer time library???

Can you read???

Right there on that page is a bold heading that says Update...

Can you follow the link???

Does all the extra punctuation really help??? Not a bit. So, knock it off.

Does that attitude really help??? Not a bit. So, knock it off.

PaulS:

Can you give me a link for a newer time library???

Can you read???

Right there on that page is a bold heading that says Update...

Can you follow the link???

Does all the extra punctuation really help??? Not a bit. So, knock it off.

Ok if the extra punctuation is so much trouble for you I will knock it off but this is not the right attitude for someone who is new and needs help, anyway,

I download the updated libraries and now i get these error messages:

sketch_dec16a.ino:2:20: error: RTClib.h: No such file or directory
sketch_dec16a:6: error: 'RTC_DS1307' does not name a type
sketch_dec16a.ino: In function 'void setup()':
sketch_dec16a:37: error: 'RTC' was not declared in this scope
sketch_dec16a.ino: In function 'void loop()':
sketch_dec16a:66: error: 'DateTime' was not declared in this scope
sketch_dec16a:66: error: expected `;' before 'now'
sketch_dec16a:68: error: request for member 'hour' in 'now', which is of non-class type 'time_t ()()'
sketch_dec16a:70: error: request for member 'minute' in 'now', which is of non-class type 'time_t ()()'
sketch_dec16a:72: error: request for member 'second' in 'now', which is of non-class type 'time_t ()()'

I download the updated libraries and now i get these error messages:

The first one says that you didn't do it right.

PaulS:

I download the updated libraries and now i get these error messages:

The first one says that you didn't do it right.

Thank you very much! Is working thanks I can continue now and when I complete my hole project I will post it.