I apologize I am really new to Arduino, this is actually my first big project. I am trying to make an accelerometer that can measure recoil on a firearm. I found a github (https://github.com/ammolytics/projects/blob/master/accelerometer/sensor_logger.ino) with all of the information and I thought it would be a simply copy and paste. I am able to use the Real Time Clock, as well as read and write onto the SD card (using a adalogger feather wing for those). I am able to use the accelerometer in real time (using an adafruit LIS3DH), but when I try to import his code I get a "compilation error: request for member 'flush' is ambiguous" message. Any help is appreciated and of course if you need a closer look at the code or my wiring itself I'd be happy to share that as well.
Please post the code, using code tags. and the full error message.
Compiling the code from the link provided by the OP, I get the following error message:
/home/username/Downloads/projects-develop/accelerometer/sensor_logger/sensor_logger.ino: In function 'void setup()':
sensor_logger:145:12: error: request for member 'flush' is ambiguous
dataFile.flush();
^~~~~
In file included from /home/username/Arduino/libraries/SdFat/src/FsLib/FsLib.h:31:0,
from /home/username/Arduino/libraries/SdFat/src/SdFat.h:33,
from /home/username/Downloads/projects-develop/accelerometer/sensor_logger/sensor_logger.ino:14:
/home/username/Arduino/libraries/SdFat/src/FsLib/FsFile.h:207:8: note: candidates are: void FsBaseFile::flush()
void flush() { sync(); }
^~~~~
In file included from /home/username/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Stream.h:26:0,
from /home/username/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/HardwareSerial.h:29,
from /home/username/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Arduino.h:233,
from /tmp/arduino_build_581747/sketch/sensor_logger.ino.cpp:1:
/home/username/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Print.h:90:18: note: virtual void Print::flush()
virtual void flush() { /* Empty implementation for backward compatibility */ }
^~~~~
Looks like a conflict with the Stream library. Since the function used by the SdFat library just calls sync(), you should be able to replace flush() with sync() in the sketch.
Wow you're amazing thank you! Replacing the flush() with sync() did the trick!