RAK15002 Example code Can't find FS.h file or directory

I am trying to upload this example code: https://github.com/RAKWireless/WisBlock/blob/master/examples/RAK11200/IO/RAK15002_SD_Card/RAK15002_SD_Card.ino

To my Rak4631. I followed the setup instructions like downloading the SDFat library and properly setting up the SD Card. However, when I try to compile this code, I get the following error:

C:\Users\pareekprad\Downloads\RAK15002_SD_Card\RAK15002_SD_Card.ino:12:10: fatal error: FS.h: No such file or directory
   12 | #include "FS.h"
      |          ^~~~~~
compilation terminated.
Multiple libraries were found for "SD.h"
  Used: C:\Users\pareekprad\Documents\Arduino\libraries\SD
  Not used: C:\Users\pareekprad\AppData\Local\Arduino15\libraries\SD
Using library SPI at version 1.0 in folder: C:\Users\pareekprad\AppData\Local\Arduino15\packages\rakwireless\hardware\nrf52\1.3.3\libraries\SPI 
Using library SD at version 1.2.4 in folder: C:\Users\pareekprad\Documents\Arduino\libraries\SD 
exit status 1

Compilation error: FS.h: No such file or directory

I have noticed that I can remove the include statement for FS.h and everything will compile fine and writes and reads to the SD Card seem to work. There is one additional problem that I want to be able to program my Rak kit & give it power, have the program continuously write to the SD Card, then remove the SD card, and then be able to re-insert the SD card and have the rak kit start writing to it again automatically. When I try to do this right now, upon removing the SD card I begin to get write and read failures, and then when I reinsert the SD card I keep on getting these write and read failures.

My guess is that the reason I can’t reinsert the SD card and continue making writes and reads to the SD card is something related to not including FS.h, but if it is something else, let me know!

Hello Dhruv,

Seems to be a conflict with multiple libraries for the file system or a problem with the way the include is written. However, it compiles without problems for me.

Can you try to change the way the include is written to

#include <FS.h>

using < and > instead of " ?

For the problem that the card is not working after removal/reinsert, I doubt that the library has any functionality to swap SD cards while the ESP32 is running.
When you remove the card, are you changing anything on the card before you reinsert it?

Hi Bernd,

I tried changing the was the include is written to the way you mentioned and still got the error for

/Users/dhruv/Downloads/RAK15002_SD_Card/RAK15002_SD_Card.ino:11:10: fatal error: FS.h: No such file or directory
   11 | #include <FS.h>
      |          ^~~~~~
compilation terminated.

I also deleted C:\Users\pareekprad\AppData\Local\Arduino15\libraries\SD temporarily to see what would happen and I still got the same “No such file or directory error.” But this time I didn’t get the additional lines:

Multiple libraries were found for "SD.h"
  Used: C:\Users\pareekprad\Documents\Arduino\libraries\SD
  Not used: C:\Users\pareekprad\AppData\Local\Arduino15\libraries\SD
Using library SPI at version 1.0 in folder: C:\Users\pareekprad\AppData\Local\Arduino15\packages\rakwireless\hardware\nrf52\1.3.3\libraries\SPI 
Using library SD at version 1.2.4 in folder: C:\Users\pareekprad\Documents\Arduino\libraries\SD 

I also am not changing anything on the SD card before reinserting it.

I got confused, I thought you were using RAK11200.

On RAK4631, you do not need the FS.h indeed.
I think you copied the wrong example code. Try this one RAK15002_SD_Card The examples for RAK4631, RAK11200 and RAK11310 are slightly different.

Still, I don’t think hot-swap of the SD card is possible.