Teensy 3.2, Read Test (DS1307RTC) broken

Status
Not open for further replies.

Matadormac

Well-known member
Good day all. Currently working on Windows 10 PC, Arduino 1.6.6 and latest TeensyDuino software (1.26-beta-3).

I have been working moving a data logger and portable environment meter to the world of Teensy (3.2). All was going smoothly until I wired in a RTC breakout board (ZS-042) and tried to work with it. I could get the original Unix time but nothing else. Also when trying the DS1307RTC library examples each example threw errors and wouldn't compile.

I used the I2C scanner and found that there were no conflicts with addresses and this breakout board has pull up resistors built in.

Eventually I backtracked the errors thrown by the DS1307 example sketches to be saying that a library was not loading. This library turned out to be the TimeLib.h library. Although this is called out in the Time.h document, for some unknown reason, the compiler wasn't seeing it.

I modified the DS1307RTC.h file to directly call out TimeLib.h. Now the sketches compile and all is well in accessing the clock.

My simple modification was to take:
HTML:
/*
 * DS1307RTC.h - library for DS1307 RTC
 * This library is intended to be uses with Arduino Time.h library functions
 */

#ifndef DS1307RTC_h
#define DS1307RTC_h

#include <Time.h>

// library interface description
class DS1307RTC

and add #include <TimeLib.h> so that the above now looks like this:
HTML:
/*
 * DS1307RTC.h - library for DS1307 RTC
 * This library is intended to be uses with Arduino Time.h library functions
 */

#ifndef DS1307RTC_h
#define DS1307RTC_h

#include <Time.h>
#include <TimeLib.h>

// library interface description
class DS1307RTC

This simple modification to the top portion of the DS1307.RTC.h file allows my sketch to compile, load and run.

I post this in the hope that others might benefit.

Regards
 
Status
Not open for further replies.
Back
Top