Go Down

Topic: DS1307 time to int? (Read 880 times) previous topic - next topic

ajax409

Just in case anyone else looks up the thread this code now works as expected!

Code: [Select]

#include <SD.h>
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC; //DS1307 Real Time Clock

// int voltage_pin = 2;
// int amperage_pin = 1;

void setup()
{
Serial.begin(57600);  //Start serial comms
Wire.begin();
RTC.begin();

if (! RTC.isrunning()) {
  Serial.println("RTC is NOT Running!");
}
}

void loop()
{
  DateTime now = RTC.now();
  Serial.println(now.year(), DEC);
  int tyear = now.year();
  Serial.println(tyear);
  delay(5000);
 
}


Thank you marco_c very much for helping me with the syntax!

Go Up