DS3232 library errors

Hello
This is probably an error on my part, but I can't get the examples to compile.
Freshly downloaded Jack Christensen's library from GitHub, all looks fine, but running, say, the TimeRTC example, I get the following errors. Deleted library once and re-copied into Arduino/Sketchbook/Libraries, but to no avail.

Arduino: 1.6.12 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Phil\Documents\Arduino\libraries\DS3232RTC\examples\TimeRTC\TimeRTC.ino:8:0:

C:\Users\Phil\Documents\Arduino\libraries\DS3232RTC/DS3232RTC.h:136:26: error: 'tmElements_t' has not been declared

static byte read(tmElements_t &tm);

^

C:\Users\Phil\Documents\Arduino\libraries\DS3232RTC/DS3232RTC.h:137:20: error: 'tmElements_t' has not been declared

byte write(tmElements_t &tm);

^

C:\Users\Phil\Documents\Arduino\libraries\DS3232RTC\examples\TimeRTC\TimeRTC.ino: In function 'void setup()':

TimeRTC:15: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(RTC.get); // the function to get the time from the RTC

^

TimeRTC:16: error: 'timeStatus' was not declared in this scope

if(timeStatus() != timeSet)

^

TimeRTC:16: error: 'timeSet' was not declared in this scope

if(timeStatus() != timeSet)

^

C:\Users\Phil\Documents\Arduino\libraries\DS3232RTC\examples\TimeRTC\TimeRTC.ino: In function 'void digitalClockDisplay()':

TimeRTC:31: error: 'hour' was not declared in this scope

Serial.print(hour());

^

TimeRTC:32: error: 'minute' was not declared in this scope

printDigits(minute());

^

TimeRTC:33: error: 'second' was not declared in this scope

printDigits(second());

^

TimeRTC:35: error: 'day' was not declared in this scope

Serial.print(day());

^

TimeRTC:37: error: 'month' was not declared in this scope

Serial.print(month());

^

TimeRTC:39: error: 'year' was not declared in this scope

Serial.print(year());

^

exit status 1
'setSyncProvider' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Grateful for any advice, please

I'm guessing that the Time library was not installed.
If you turn on verbose mode you will see all the errors and warnings and you might see some additional information.

--- bill

You suspect that you also need a time library. I think it's this one: GitHub - PaulStoffregen/Time: Time library for Arduino

A bit of a mystery so far as I have sketches running with Time.h included and compile and run successfully and just double-checked my Documents>Arduino>Libraries and Time library is there.

I'm running 1.6.12 and wondering if this is an old version of Time as I have seen some warnings that the old version does not work.

Having checked the contents of my Time library, it looks pretty much up to date and came fromhttps://github.com/PaulStoffregen/Time - this has comments dated only days ago.

So far, it is only Jack Christensen's library DS3232RTC that does not work - there is a note on the description on GitHub

DS3232RTC is an Arduino library that supports the Maxim Integrated DS3232 and DS3231 Real-Time Clocks. This library is intended to be used with the Arduino Time library.

  • the Arduino Time Library links you back to the old Time.h, so I'm not sure if DS3232RTC is going to work with the newer Time.h

I'll investigate further and I'd be interested if anyone else can replicate the errors or better still get it to compile and tell me how you did it. Maybe Jack could throw some light on it.

The TimeRTC sketch does not have any issues compiling for me.
But I'm using linux.
Also, you haven't fully described your entire environment (exact version of all s/w involved) so it will not be possible for anyone to replicate or comment on your issue.

Turn on verbose mode and post full output from the compile as it should be easy to tell what is happening from the full information.

BTW,
There is no need to install the Time library manually as it is available in the IDE library manager. It is the code from Pauls repo.

--- bill

Hello Bill

I've spent hours on this and here it is knocking on bedtime.
Having put all the information together, the sodding message preview has come up with message exceeds 9000 characters.
I can try and split it up or do it as attachments.
In a nutshell, I can't find anything in my library manager about Paul S's Time library, only Mike Margolis version 1.0.5 installed, but I'm certain that the Time library in Documents>Arduino>Libraries is the Paul S version as it has timeAdjust() which I am using which I don't think is in the Margolis version.
Also, the readme file contains

/*
  time.h - low level time and date functions
*/

/*
  July 3 2011 - fixed elapsedSecsThisWeek macro (thanks Vincent Valdy for this)
              - fixed  daysToTime_t macro (thanks maniacbug)
*/     

#ifndef _Time_h
#ifdef __cplusplus
#define _Time_h

#include <inttypes.h>
#ifndef __AVR__
#include <sys/types.h> // for __time_t_defined, but avr libc lacks sys/types.h
#endif


#if !defined(__time_t_defined) // avoid conflict with newlib or other posix libc
typedef unsigned long time_t;
#endif

which makes me think it is the Paul S version

The software environment is Win 10 Pro 1607 build, Arduino IDE 1.6.12

I have also installed the Timezone library from Jack and that comes up with the same compile errors

Thanks for your efforts and let me know if there are enough clues or I send the whole lot as a .doc file attachment.

I'll send the doc file tomorrow anyhow as an attachment

I am beginning to think that this has something to do with exactly which Time library is being used.

Phil

Typo error
Margolis version 1.5.0 installed, not 1.0.5

Again, the only way for me to comment further about what is causing the issue is to see the output from the compile.
Turn on verbose mode and post the output.
Don't put the text output into a microsoft proprietary word .doc file. There is no need to do that and it creates extra work for everyone else.Post it as in line or attach it as a text file.
If it it is too large to do inline, just copy & paste the output into a simple ascii text file.

In terms of the which Time library is being used, the library in IDE library manager is the Time library from Pauls git hub repository.
If you are curious, you can look in the library manager .json file down under the packages area.
(no clue where that is stored on Windows, on linux it is in ~/.arduino15/packages/library_index.json)

Michael originally wrote it, and the IDE library manger now points to Pauls github repo.
If you look at the .properties file for the library, you should see that it shows Michael as the Author and Paul as the maintainer.

--- bill

  • the Arduino Time Library links you back to the old Time.h, so I'm not sure if DS3232RTC is going to work with the newer Time.h

Based on the code you posted which looks like the comments at the head of TimeLib.h I am using the same library. The ide identifies it as v 1.5.0 of the Margolis library.

I am using it successfully with the Christensen DS3232 library. I am running IDE v1.6.9 with Windows 10.

Here's the explanation of the problem and the solution:

I'm don't know why JChristensen doesn't just merge that PR to prevent these sorts of issues.

Bill, Pert, Cattledog
Looks like something to digest and test.

Just did it - added TimeLib.h to the DS3232 Clock and TimeRTC examples and it now compiles, plus Timezone examples.
A lot of sweating over one line of code, or three letters.
I must admit that I looked at many of the readme's, but the one in Pert's comment hadn't come to light - I was begining to wonder why some of the sketches (untested) had TimeLib.h and others Time.h

This raises another beginner question - which one do I use, Time.h or TimeLib.h? Some old sketches have Time.h and work fine. Are these best left alone?

But most grateful for a solution.

Bill - I guess the verbose copy won't be needed now - you say you are using Linux, so are you able to compile with Time.h instead of TimeLib.h?