Hello, I am trying to use the parseInt() function (which works fine with <SD.h>) with the SdFat library.
The code data logs information to a micro SD card and was working well before I made changes today...
I added this section of code which I previously tested with the <SD.h> library.
while (myFile.available()) { // read from the file until there's nothing else in it:
int x = myFile.parseInt();
if ( x != 0){
main_deploy_alt = x;
}
}
myFile.close();// close the file:
}
The error i get is:
Arduino: 1.8.16 (Mac OS X), Board: "SparkFun Pro Micro, ATmega32U4 (3.3V, 8 MHz)"
/Users/XXXXXXXXXX/Documents/Arduino/Data_Logger_Micro4/sd_header.ino: In function 'void sd_header()':
sd_header:19:23: error: 'class SdFile' has no member named 'parseInt'; did you mean 'print'?
int x = myFile.parseInt();
^~~~~~~~
print
Multiple libraries were found for "Wire.h"
Used: /Applications/Arduino-2.app/Contents/Java/hardware/arduino/avr/libraries/Wire
Not used: /Users/XXXXXXXX/Documents/Arduino/libraries/Wire
exit status 1
'class SdFile' has no member named 'parseInt'; did you mean 'print'?
I've been through this forum post and not had any joy with it.
I initially had 2 SdFat libraries installed, SdFat & SdFat-master. I moved both of them, downloaded the latest SdFat-master then renamed it SdFat. I also tried changing this line of code in the config file "SdFatConfig.h"
/**
* Set INCLUDE_SDIOS nonzero to include sdios.h in SdFat.h.
* sdios.h provides C++ style IO Streams.
*/
#ifndef INCLUDE_SDIOS
#define INCLUDE_SDIOS 1
#endif // INCLUDE_SDIOS
If that value is 0 or 1 it returns the same error.
All I am trying to do with the addition of parseInt() to the current code is read 1 integer from the SD card on a ".txt" file before logging data to it. I can do it nicely over serial but the parseInt allows me to put the number into an Int in my code nicely.
I also unzipped the html folder as per the instructions in the library.
If anyone has any thoughts or suggestions I'd love to hear them. If it's going to be too difficult to get parseInt to work, if there is a different method to retrieve a single number from a ".txt" file then I could use that and bypass this issue altogether.
Thanks.