Teensyduino install causes time library routines not to compile correctly

Status
Not open for further replies.

Trebuchet

New member
I have a lot of Arduino sketches and libraries installed. All was working quite smoothly with no errors for many months.
Then I installed the Teensyarduino on Arduino 1.8.1. Installation went smoothly with no errors.
Now, I get an error trying to compile the most basic TIME example.
EXAMPLE/TIME/TIMERTC
I get the following error trying to compile...
'setSyncProvider' was not declared in this scope.
I have listed the code below, but it is the basic unmodified example code.

I figure I have a library problem somewhere, somehow. I have tried to reload the time library with no change.

I can not be the first with this issue. Any help most appreciated.

Cheers.

/*
* TimeRTC.pde
* Example code illustrating Time library with Real Time Clock.
* This example is identical to the example provided with the Time Library,
* only the #include statement has been changed to include the DS3232RTC library.
*/

#include <DS3232RTC.h> //http://github.com/JChristensen/DS3232RTC
#include <Time.h> //http://www.arduino.cc/playground/Code/Time
#include <Wire.h> //http://arduino.cc/en/Reference/Wire (included with Arduino IDE)

void setup(void)
{
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(void)
{
digitalClockDisplay();
delay(1000);
}

void digitalClockDisplay(void)
{
// 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);
}
 
What Teensy is in use?
With (file/preferences) VERBOSE on the libraries used by name are shown at time of compile.
Teensy has it's own time library and copy of wire. I'd expect those should be used perhaps - but YMMV.
Is there a real DS3232RTC in use or the Teensy RTC with a crystal onboard?
Code embedded with code tags is easier to read and more compact - [C0DE] //code here - tags use O not ZERO [/C0DE]
 
#include <Time.h> //http://www.arduino.cc/playground/Code/Time

The include was changed to TimeLib.h in November 2015.

Maybe you've got an ancient copy of the Time library laying around somewhere? When you get the compile error, perhaps Arduino is trying to show you a message (with full pathnames) about multiple libraries detected?
 
Status
Not open for further replies.
Back
Top