Getting library errors from my code.

I’m writing a piece of code to do some data logging for a supercharger using an onboard pressure sensor (one of Honeywell’s SSC’s with digital output,) a thermistor, and an onboard barometric sensor. I’ve got the code working as separate functions, but when I put it all together I get some weird errors from the libraries. As I was initially putting it all together, I got some similar errors (like as I began merging my functions into the same sketch,) so I posted to the board over at ladyada.net (since the RTC is coming from there) and moving my <wire.h> #include in front of my <rtclib.h> #include fixed them. However, with all of it together I get a bunch of errors, some of which look like they’re straight from the <wire.h> library.

Here’s a copy of the code;

#include <SD.h>
#include <Wire.h>
#include <BMP085.h>
#include <RTClib.h>

#define press_sensorAddr 28                                             //I2C address for the                   
#define logInterval 2000                                                //Set the logging time in millis between logs
#define tempPin 3                                                       //The input pin that the thermistor will read on
#define redLEDpin 11
#define greenLEDpin 12
#define sccAddress 40
BMP085 bmp;
RTC_DS1307 RTC;
File logfile;
const int chipSelect = 10;
int bmpTemp, bmpPress, tTemp, lPress, tCounter, pCounter, logTimer = 0;
float pressure = 0;
int tempArray[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int pressArray[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
volatile int bmpEOC = LOW;                                              //Set up state for BMP085 EOC bit
volatile int startBit = LOW;                                            //Set up state for 'start' button, set high here for no button start


void error (char *str){
  digitalWrite(redLEDpin, HIGH);
  while(1);
}

void setup() {
  attachInterrupt(0, getI2C, RISING);                                   //Interrupt to read EOC bit
  attachInterrupt(1, startStop, CHANGE);                                //Interrupt to read 'start' button press
  bmp.begin();                                                          //Begin I2C communication as master
  pinMode(10, OUTPUT); 
  if (!SD.begin(chipSelect)) {
    return;
  }
  char filename[] = "LOGGER00.CSV";                                     //Create a file everytime startup occurs
  for (uint8_t i = 0; i < 100; i++) {                                   //...with a filename between LOGGER00 and LOGGER99
    filename[6] = i/10 + '0';
    filename[7] = i%10 + '0';
    if (!SD.exists(filename)) {                                         //Don't create the file until a name 
      logfile = SD.open(filename, FILE_WRITE);                          //...is found that doesn't exist
      break;
    }
  }
  if (! logfile) {                                                      //Give an error if the logfile could not
    error("couldn't create file");                                      //be created.
    digitalWrite(redLEDpin, HIGH);
  }
  Wire.begin();      
  if (!RTC.begin()) {                                                   //If the RTC could not be communicated with
    logfile.println("RTC failed");                                      //...log the failure
    digitalWrite (redLEDpin, HIGH);                                     //...and light the error LED
  }
  logfile.println("Millis,Time,AmbPress,AmbTemp,LPress,LTemp");         //Attempt to write a header to the file
  if (logfile.writeError || !logfile.sync()) {                          //If the header file could not be written
    error("write header failure");                                      //...set an error code
    digitalWrite (redLEDpin, HIGH);                                     //...and light the error LED
  }
  pinMode(redLEDpin, OUTPUT);
  pinMode(greenLEDpin, OUTPUT);
  logTimer = millis();
}


void loop() {
  if (bmpEOC == HIGH){
    get_bmpTemp_Press();                                                //If conversion is done, get temp and pressure
  }
  tempArray[tCounter] = analogRead(tempPin) - 238;                      //Get the thermistor temperature and add to array  
  tCounter++;                                                           //Array count increased for thermistor averaging
  if (tCounter == 10){                        
    tTemp = average_array(tempArray);                                   //Average every 10 samples
    tCounter = 0;                                                       //...and reset the averageing counter
  }
  
  if (millis()-logTimer == logInterval) {
    write_to_log(bmpPress, bmpTemp, lPress, tTemp);
  }
  
}

void getI2C() {
  bmpEOC = HIGH;                                                        //Conversion is done, set bit high
}

void startStop() {
  startBit = !startBit;                                                 //'Start' button has been pressed
}

void get_bmpTemp_Press() {
  bmpTemp = bmp.readTemperature();                                      //Get temperature
  bmpPress = bmp.readPressure();                                        //Get pressure
  bmpEOC = LOW;                                                         //Reset conversion bit after reading I2C 
}

int average_array (int array[10]){        
  int i, tempHolder = 0;
  for (i = 0; i < 11; i + 1){
    tempHolder += array[i];                                             //Add all of the saved values in the array
  }
  return tempHolder/10;                                                 //...and divide by ten, returning a 10 sample running-average
}

void get_SCC_data (byte *a, byte *b){
  Wire.requestFrom(sccAddress, 2);
  *a = Wire.recieve();
  *b = Wire.recieve();
}

int acquire_SCC_data (){
  byte aa, bb;
  boolean checkOk;
  int counts = 0;
  get_SCC_data(&aa, &bb);
  for (int i = 1; i < 3; i++){
    if(bitRead(aa, i) == 0){
    checkOk = true;
    }
  }
  if (checkOk == true){
    counts = aa + bb;
  }
  else {
    return 0;
  }
  pressure = (counts - 1638)/13107;
  return pressure;
}

void write_to_log (int aPress, int aTemp, int lPress, int lTemp) {
  DateTime now;
  digitalWrite(greenLEDpin, HIGH);                                      //Turn the green LED on
  uint32_t m = millis();                                                //Log millis since power-up
  logfile.print(m);                                                     
  logfile.print(", ");
  now = RTC.now();
  logfile.print(now.get());                                             //Log date and time in YY/MM/DD HH:MM:SS format
  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);
  logfile.print(", ");
  logfile.print(aPress);                                                //Log the Ambient Pressure
  logfile.print(",");
  logfile.print(aTemp);                                                 //Log the Ambient Temperature
  logfile.print(",");
  logfile.print(lPress);                                                //Log the Line Pressure
  logfile.print(",");
  logfile.println(aTemp);                                               //Log the Line Temperature
  logTimer = millis();                                                    //Reset the log timer
  digitalWrite(greenLEDpin, LOW);                                       //...and turn the green LED on
}

And the list of errors I get now;

line_audit_case.cpp: In function ‘void setup()’:
line_audit_case:55: error: ‘class File’ has no member named ‘writeError’
line_audit_case:55: error: ‘class File’ has no member named ‘sync’
line_audit_case.cpp: In function ‘void get_SCC_data(byte*, byte*)’:
line_audit_case:106: error: ‘class TwoWire’ has no member named ‘recieve’
line_audit_case:107: error: ‘class TwoWire’ has no member named ‘recieve’
line_audit_case.cpp: In function ‘void write_to_log(int, int, int, int)’:
line_audit_case:137: error: ‘class DateTime’ has no member named ‘get’

Any help is appreciated as I’m okay when writing in Arduino and some Python, but I’m still trying to learn C-based code, so forgive my ignorance on the topic.

-Ian

line_audit_case:55: error: 'class File' has no member named 'writeError'

How much more descriptive can an error message get? If a class has a method, you can call that method. If it doesn't, you can't. Wishing you could won't change a thing.

line_audit_case:55: error: 'class File' has no member named 'sync'

Ditto.

line_audit_case:106: error: 'class TwoWire' has no member named 'recieve'

Ditto.

The rest of the errors are the same kind. Look at the classes being referenced in the errors. Look at the methods available. Only call those methods.

iyeager:
line_audit_case:106: error: 'class TwoWire' has no member named 'recieve'

TwoWire has a member called "receive" but not "recieve".

Thanks for your help, honestly I had never looked at any of the classes before, and those pieces of code (except for the 'i' before 'e' screw up) came straight from the ladyada site. To be honest, I still don't know what I was looking at, but removing the offending lines seemed to have fixed the code.

-Ian