Logger Shield get() function error

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
keen101
 
Posts: 52
Joined: Wed Apr 23, 2008 8:51 pm

Re: Logger Shield get() function error

Post by keen101 »

Code: Select all

sketch_feb16a:43: error: ‘class DateTime’ has no member named ‘get’
Yeah, i just got that error. I was using code copy and pasted from the basic code tutorial. from http://www.ladyada.net/make/logshield/rtc.html

...I'll try to replace it with unixtime( ) or secondstime()...

EDIT: okay.. the example from /examples/ds1307/ds1307.pde had unixtime, and it compiled this time. Thanks everyone!

As of this post the tutorial on the website still says:

Code: Select all

    // calculate a date which is 7 days and 30 seconds into the future
    DateTime future (now.get() + 7 * 86400L + 30);

User avatar
oceanmono
 
Posts: 57
Joined: Sun Apr 03, 2016 10:34 pm

Re: Logger Shield get() function error

Post by oceanmono »

I followed the steps in https://learn.adafruit.com/adafruit-dat ... me-clock-3 and got the same error.

// fetch the time
now = RTC.now();
// log time
logfile.print(now.get()); // seconds since 2000
:
:
#if ECHO_TO_SERIAL
Serial.print(now.get()); // seconds since 2000


After changing the code to the following, the error is gone. Is this all I need to do for the program to record and display the time correctly? Is this fix location specific?

// fetch the time
now = RTC.now();
// log time
logfile.print(now.secondstime()); // seconds since 2000
:
:
#if ECHO_TO_SERIAL
Serial.print(now.secondstime()); // seconds since 2000

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

Re: Logger Shield get() function error

Post by adafruit_support_mike »

Just to check, are you using the Adafruit version of RTClib?

We've done a lot of work on that recently, adding support for several new kinds of clocks that we carry.

User avatar
oceanmono
 
Posts: 57
Joined: Sun Apr 03, 2016 10:34 pm

Re: Logger Shield get() function error

Post by oceanmono »

I installed the Adafruit RTClib folder under libraries. However, I have not bought a RTC yet. I just tested the part on the sd card. I am going to buy a RTC breakout board. Any recommendation?

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

Re: Logger Shield get() function error

Post by adafruit_support_mike »

If you want to use the code from the project linked above, you'll want a DS1307. Those come on the Datalogger Shield and as separate breakout kits.

Take a look at the range of RTCs in the shop though, and see which one is most likely to fit your needs:

https://www.adafruit.com/categories/858

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

Return to “Arduino Shields from Adafruit”