SD error

Hi,

I'm trying to write the code to program an SD card on a data logging shield. So I can't figure out how to fix / what this error means.

RTC.ino: In function 'void loop()':
RTC:109: error: 'class DateTime' has no member named 'get'

I'd appreciate any and all advice!

Some simple advice:

"Post the code!!!!!!"

#include <LiquidCrystal.h>
#include “SD.h”
#include <Wire.h>
#include “RTClib.h”

#define LOG_INTERVAL 1000 // mills between entries
#define ECHO_TO_SERIAL 1 // echo data to serial port
#define WAIT_TO_START 0 // Wait for serial input in setup()

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int sensorPin = A0;
int sensorValue;
float Res = 10.0;

RTC_DS1307 RTC; // define the Real Time Clock object

// for the data logging shield, we use digital pin 10 for the SD cs line
const int chipSelect = 10;

// the logging file
File logfile;

void error(char *str)
{
Serial.print("error: ");
Serial.println(str);

while(1);
}

void setup(){
lcd.begin(16,2);
lcd.clear();
Serial.begin(9600);
Serial.println();
Serial.print(“Initializing SD card…”);
pinMode(10, OUTPUT);

// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println(“Card failed, or not present”);
return;
}
Serial.println(“card initialized.”);

// create a new file
char filename = “LOGGER00.CSV”;
for (uint8_t i = 0; i < 100; i++) {
filename[6] = i/10 + ‘0’;
filename[7] = i%10 + ‘0’;
if (! SD.exists(filename)) {
// only open a new file if it doesn’t exist
logfile = SD.open(filename, FILE_WRITE);
break; // leave the loop!
}
}
if (! logfile) {
error(“couldnt create file”);
}

Serial.print("Logging to: ");
Serial.println(filename);
Wire.begin();
if (!RTC.begin()) {
logfile.println(“RTC failed”);
#if ECHO_TO_SERIAL
Serial.println(“RTC failed”);
#endif //ECHO_TO_SERIAL
}

logfile.println(“millis,time,light”);
ECHO_TO_SERIAL;
Serial.println(“millis,time,light”);
ECHO_TO_SERIAL; // attempt to write out the header to the file

}

void loop(){
sensorValue = analogRead(sensorPin);
float Vout = sensorValue*0.0048828125;
delay(100);
Serial.print(“Voltages”);
Serial.print(Vout);
lcd.print(“V\t”);
lcd.print(sensorValue);
delay(200);{
if(Serial.available()){
delay(100);
lcd.clear();
DateTime now;

// delay for the amount of time we want between readings
delay((LOG_INTERVAL -1) - (millis() % LOG_INTERVAL));

// log milliseconds since starting
uint32_t m = millis();
logfile.print(m); // milliseconds since start
logfile.print(", “);
#if ECHO_TO_SERIAL
Serial.print(m); // milliseconds since start
Serial.print(”, ");
#endif

// fetch the time
now = RTC.now();
// log time
logfile.print(now.get()); // seconds since 2000
logfile.print(", “);
logfile.print(now.year(), DEC);
logfile.print(”/");
logfile.print(now.month(), DEC);
logfile.print("/");
logfile.print(now.day(), DEC);
logfile.print(" “);
logfile.print(now.hour(), DEC);
logfile.print(”:");
logfile.print(now.minute(), DEC);
logfile.print(":");
logfile.print(now.second(), DEC);
#if ECHO_TO_SERIAL
Serial.print(now.get()); // seconds since 2000
Serial.print(", “);
Serial.print(now.year(), DEC);
Serial.print(”/");
Serial.print(now.month(), DEC);
Serial.print("/");
Serial.print(now.day(), DEC);
Serial.print(" “);
Serial.print(now.hour(), DEC);
Serial.print(”:");
Serial.print(now.minute(), DEC);
Serial.print(":");
Serial.print(now.second(), DEC);
#endif //ECHO_TO_SERIAL
int photocellReading = analogRead(photocellPin);
delay(10);

// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = tempReading * 5.0 / 1024;

logfile.print(", ");
logfile.print(photocellReading);

#if ECHO_TO_SERIAL
Serial.print(", ");
Serial.print(photocellReading);

#endif //ECHO_TO_SERIAL

}
}
}
}

Here's an idea, have a look at the DateTime class, and see if you can find a function called get( ). It is either there, or it isn't.

What to look at, after that, depends on the answer to that question.

RTC.ino: In function 'void loop()':
RTC:109: error: 'class DateTime' has no member named 'get'

Is this the ONLY compilation error that you get ?

So what is the Datetime class?

And no I get a few errors, but the first two are about the 'get'

Its using the Adafruit RTClib.h whose datetime class doesn't have a get() method,
from the comment the method secondstime() is intended. Perhaps an old version
of the library had a different method name?

PS

 code tags for code please