SetSerial: 'RTC' not declared in this scope
philiporlando opened this issue · 4 comments
The SetSerial sketch fails to compile after including .ZIP library.
I am getting the following error:
'RTC' was not declared in this scope
Using library DS3232RTC-master at version 1.2.0.
For non-AVR architectures (e.g. ESP8266) a DS3232RTC object needs to be defined, so a slight modification to the example sketch would be needed. See https://github.com/JChristensen/DS3232RTC#constructor
Thanks for the response, and apologies for filing an issue that has already been addressed. However, I am still running into issues, and the ability to manually adjust the RTC without the lag-time from the SetTime sketch is crucial for the success of my research project.
Would you mind providing some additional information for getting the SetSerial sketch to work with non-AVR boards. I am using a Teensy3.2 Cortex-M4 architecture for this project.
I have modified the SetSerial example to include the following, but I am running into a SetSerial:49: error 'RTC' was not declared in this scope
error.
Here's what my header and setup loop look like:
#include <DS3232RTC.h> //http://github.com/JChristensen/DS3232RTC
#include <Streaming.h> //http://arduiniana.org/libraries/streaming/
// For non-AVR boards only. Not needed for AVR boards.
DS3232RTC myRTC(false); // tell constructor not to initialize the I2C bus.
void setup(void)
{
Serial.begin(115200);
myRTC.begin(); // initialize the I2C bus here.
//setSyncProvider() causes the Time library to synchronize with the
//external RTC by calling RTC.get() every five minutes by default.
setSyncProvider(RTC.get);
Serial << F("RTC Sync");
if (timeStatus() != timeSet) Serial << F(" FAIL!");
Serial << endl;
}
Your input is greatly appreciated!
Hi Philip, no worries. I have a to-do in the pipeline to make the API consistent for all architectures and also to clarify the doc accordingly. Since the DS3232RTC object is defined as "myRTC", all references to "RTC" in the sketch need to be changed to "myRTC". Or, instead, change the definition to "DS3232RTC RTC;"
If that doesn't get you going, let me know.
HTH ... jc
This did the trick. Clearly I have a lot more to learn...
A million thank yous!