Data Logger

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Data Logger

Post by PRojeskiJr »

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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logger

Post by adafruit_support_bill »

[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

User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Re: Data Logger

Post by PRojeskiJr »

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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logger

Post by adafruit_support_bill »

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.
You need all the files from RTCLib-Master - not just RTCLib.h.
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.

User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Re: Data Logger

Post by PRojeskiJr »

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.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Data Logger

Post by adafruit_support_mike »

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.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Data Logger

Post by Franklin97355 »

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
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.

User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Re: Data Logger

Post by PRojeskiJr »

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?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logger

Post by adafruit_support_bill »

Which example code are you using? The DateCalc example uses this code to print the date & time.

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();
}
It is pretty simple to re-arrange the output to whatever format you want.

User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Re: Data Logger

Post by PRojeskiJr »

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??

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logger

Post by adafruit_support_bill »

What code are you trying to compile?

User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Re: Data Logger

Post by PRojeskiJr »

The First RTC test sketch for the data logger shield, page 16 of 63.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logger

Post by adafruit_support_bill »

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.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Data Logger

Post by pburgess »

There should be two underscores before and after DATE and TIME, i.e.:

Code: Select all

    rtc.adjust(DateTime(__DATE__, __TIME__));
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?

User avatar
PRojeskiJr
 
Posts: 10
Joined: Mon Aug 25, 2014 4:02 pm

Re: Data Logger

Post by PRojeskiJr »

The two underscores did the trick. Thanks!! I was using the sketch provided in the instructions for the new and improved logging shield.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”