Loading...
Pages: 1 [2]   Go Down
Author Topic: Do action at certain time using RTC  (Read 686 times)
0 Members and 1 Guest are viewing this topic.
Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 354
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Sheffield
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: January 29, 2013, 06:55:06 pm by MattHadfield » Logged

Matthew Hadfield

Current Project (s) - Fishtank Controller - Arduino Uno

I maybe new, but i learn fast smiley-wink

Queens, New York
Offline Offline
Edison Member
*
Karma: 28
Posts: 1563
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Sheffield
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

Matthew Hadfield

Current Project (s) - Fishtank Controller - Arduino Uno

I maybe new, but i learn fast smiley-wink

Queens, New York
Offline Offline
Edison Member
*
Karma: 28
Posts: 1563
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

did you try the example TimeRTC? Look in the Setup(), it might be just what your missing.
Code:
/*
 * 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);
}
Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Pages: 1 [2]   Go Up
Print
 
Jump to: