Heyho,
is it possible to use the same library for two things at the same time?
E.g. If I have two SD cards attached to different pins, I need the SD-library to read/write both SD-Cards.
Can I use one library to controll both SD-cards at two different pins or is there some other trick to do so?
Because as far as I know, I can't use a library twice in one programm...
Thanks in advance for your help!
Greetings from Germany
cave2596
Thanks a lot for your fast answer!
I'll check if for the classes in the library in order to find out.
Have a wonderful day!
#include <SD.h>
byte SDSS2 = 5; // Slave Select pin for second SD card.
SDClass SD2;
void setup() {
SD.begin();
SD2.begin(SDSS2);
}
void loop() {
}
The library creates one instance (named 'SD') but doesn't seem to mind users creating more. I don't know if the library will work properly if you do this.
Delta_G:
I would be seriously concerned about the memory usage. SD makes a big big buffer. 512 bytes IIRC.
The sketch above used 48% of RAM on an UNO. I added three MORE instances and the memory use went up to 53%. I hope that means that the buffer is properly shared across instances.