Data Logger
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Data Logger
Just getting started, made it to the first RTC test - sketch won't compile- Error Message: RTClib.h "no such file" and RTC-DS1307 "does not name a type"; using a Mac. RTlib.h appears to be in my file. Does RTClib-Master have to be renamed because it contains a "-"? If so, how do I rename this file.
- adafruit_support_bill
- Posts: 88112
- Joined: Sat Feb 07, 2009 10:11 am
Re: Data Logger
[Moving to General Project Help.]
The compiler was not able to find the library in the expected location.
Make sure that your RTCLib is installed according to these instructions: http://learn.adafruit.com/adafruit-all- ... nstall-use
The compiler was not able to find the library in the expected location.
Make sure that your RTCLib is installed according to these instructions: http://learn.adafruit.com/adafruit-all- ... nstall-use
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Re: Data Logger
I've read those instructions several times and I must not be understanding the directions. I've changed RTClib-master file name to RTClib_master. The file RTClib.h is in the RTClib_master file, but the same error shows up. What should I try next? Thanks.
- adafruit_support_bill
- Posts: 88112
- Joined: Sat Feb 07, 2009 10:11 am
Re: Data Logger
You need all the files from RTCLib-Master - not just RTCLib.h.I've changed RTClib-master file name to RTClib_master. The file RTClib.h is in the RTClib_master file, but the same error shows up.
The RTCLib_master folder needs to be located in your sketchbook Libraries folder.
You need to exit and restart the IDE before it will recognize the new library.
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Re: Data Logger
I continue to be confused by the instructions in Arduino Libraries for Mac OSX machines. In my Document folder there is a file names Arduino which I understand IS the Sketchbook folder for a Mac. A Libraries folder and all of my sketches are included.
The Library folder contains a readme.text and an RTClib folder. The RTClib folder contains the RTClib_master folder, which contains an examples folder, a keywords file, a reame.text file, an RTClib.cpp file, and an RTClib.h file. If I click on my RTC Test sketch, and try to compile it, I get the error messages I previously described.
What is most confusing is the Re-start the IDE screenshot on page 12 in the Arduino Libraries instructions for a Mac. On my computer I can not find a screen with headings Apple File Edit Sketch Tools Help, and under "File" there a file called sketchbook, then Libraries then the Motor-Shield example - then the Applications screen???
I can start the Arduino from an icon under Applications, but I usually start if from a sketch in the Arduino folder.
I guess I don't understand how to close the IDE and how to re-start the IDE. Is this involve shutting down and re-opening the sketch? Thanks for your help.
The Library folder contains a readme.text and an RTClib folder. The RTClib folder contains the RTClib_master folder, which contains an examples folder, a keywords file, a reame.text file, an RTClib.cpp file, and an RTClib.h file. If I click on my RTC Test sketch, and try to compile it, I get the error messages I previously described.
What is most confusing is the Re-start the IDE screenshot on page 12 in the Arduino Libraries instructions for a Mac. On my computer I can not find a screen with headings Apple File Edit Sketch Tools Help, and under "File" there a file called sketchbook, then Libraries then the Motor-Shield example - then the Applications screen???
I can start the Arduino from an icon under Applications, but I usually start if from a sketch in the Arduino folder.
I guess I don't understand how to close the IDE and how to re-start the IDE. Is this involve shutting down and re-opening the sketch? Thanks for your help.
- adafruit_support_mike
- Posts: 67459
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Data Logger
To restart the Arduino IDE, use command-Q to quit then double-click the Arduino icon in the Finder to start the IDE again.
Once you've done that, select the File -> Examples popup menu and see if it contains an item for the RTC library.
Once you've done that, select the File -> Examples popup menu and see if it contains an item for the RTC library.
- Franklin97355
- Posts: 23917
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Data Logger
I'm not a Mac person but on windows machines the libraries folder should contain a folder with the same name as the .cpp file inside ( Documents/Arduino/libraries/RTClib/RTClib.cpp ) and the other files like the .h and examples folder.The Library folder contains a readme.text and an RTClib folder. The RTClib folder contains the RTClib_master folder, which contains an examples folder, a keywords file, a reame.text file, an RTClib.cpp file, and an RTClib.h file
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Re: Data Logger
Resolved above problem. Next problem: The format for the RTC appears to be: Year/Month/Day Hour/Min/Sec,
My Mac doesn't have this format and I getting incorrect data on my Serial monitor. Can I change the coding so that it matches my Mac?
My Mac doesn't have this format and I getting incorrect data on my Serial monitor. Can I change the coding so that it matches my Mac?
- adafruit_support_bill
- Posts: 88112
- Joined: Sat Feb 07, 2009 10:11 am
Re: Data Logger
Which example code are you using? The DateCalc example uses this code to print the date & time.
It is pretty simple to re-arrange the output to whatever format you want.
Code: Select all
void showDate(const char* txt, const DateTime& dt) {
Serial.print(txt);
Serial.print(' ');
Serial.print(dt.year(), DEC);
Serial.print('/');
Serial.print(dt.month(), DEC);
Serial.print('/');
Serial.print(dt.day(), DEC);
Serial.print(' ');
Serial.print(dt.hour(), DEC);
Serial.print(':');
Serial.print(dt.minute(), DEC);
Serial.print(':');
Serial.print(dt.second(), DEC);
Serial.print(" = ");
Serial.print(dt.unixtime());
Serial.print("s / ");
Serial.print(dt.unixtime() / 86400L);
Serial.print("d since 1970");
Serial.println();
}
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Re: Data Logger
With the following line commented, //RTC.adjust(DateTime(_DATE_,_TIME_)); the sketch compiles. When I uncomment the line, I get an error message that says "Date not defined" and another that says "Time not defined", and it won't compile. Any ideas??
- adafruit_support_bill
- Posts: 88112
- Joined: Sat Feb 07, 2009 10:11 am
Re: Data Logger
What code are you trying to compile?
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Re: Data Logger
The First RTC test sketch for the data logger shield, page 16 of 63.
- adafruit_support_bill
- Posts: 88112
- Joined: Sat Feb 07, 2009 10:11 am
Re: Data Logger
Are you using the text from the tutorial or the example sketch from the library? There have been recent changes to the library and the example from the library is more up-to-date. I was able to compile it here without problem.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Data Logger
There should be two underscores before and after DATE and TIME, i.e.:
If that doesn't fix it...what version of the Arduino IDE are you using? Also, not sure about the "page 16 of 63" part...what document are you referring to?
Code: Select all
rtc.adjust(DateTime(__DATE__, __TIME__));
- PRojeskiJr
- Posts: 10
- Joined: Mon Aug 25, 2014 4:02 pm
Re: Data Logger
The two underscores did the trick. Thanks!! I was using the sketch provided in the instructions for the new and improved logging shield.
Please be positive and constructive with your questions and comments.