Go Down

Topic: Do action at certain time using RTC (Read 8 times) previous topic - next topic

johncc


I don't see anything obvious. How about putting a few serial.printlns inyour day, night, lightson, lightsoff, etc functions to see if the alarm is triggering them. At least you'll narrow it dow to a function problem or alarm problem.

He does actually have Serial.printlns in most of those already...

I don't see anything obvious either...

MattHadfield

#16
Jan 30, 2013, 12:41 am Last Edit: Jan 30, 2013, 12:55 am by MattHadfield Reason: 1
Have i really managed to stump the knowledge of all the great Arduino Coders ?

Edit - Not sure if im on the right tracks here, but i thought as a test id put this in to see what the arduinos internal time actually is, and theres a mismatch, could this be the issue ?

http://gyazo.com/ee1a4d9dfa5e6e058e29bc5735d21984.png?1359503649
Matthew Hadfield

Current Project (s) - Fishtank Controller - Arduino Uno

I maybe new, but i learn fast ;)

HazardsMind

From the example, setTime(8,29,0,1,1,11); is included in the setup, did you put this in to test it? Other than that, it should be working.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

MattHadfield


From the example, setTime(8,29,0,1,1,11); is included in the setup, did you put this in to test it? Other than that, it should be working.


Tried this, changed the alarm time to 8:30 as per the example and it worked ! So why isnt it reading from the RTC time thats my question ?
Matthew Hadfield

Current Project (s) - Fishtank Controller - Arduino Uno

I maybe new, but i learn fast ;)

HazardsMind

did you try the example TimeRTC? Look in the Setup(), it might be just what your missing.
Code: [Select]
/*
* TimeRTC.pde
* example code illustrating Time library with Real Time Clock.
*
*/

#include <Time.h> 
#include <Wire.h> 
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t

void setup()  {
  Serial.begin(9600);
  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");     
}

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

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

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

SFO_user

I'm trying my first hand at Arduino and want to do the same with controlling a fish tank.

Can you provide some help on what sensors and hardware you are using.

Many thanks!


Go Up