This can be the hardware SS pin - pin 10 (on most Arduino boards) or pin 53 (on the Mega) - or another. Additionally, another pin must be used to select the SD card. #include // required by SD #include // required for SD card #define SDSS1pin 53 // on the UNO the Sparkfun SDSS pin is 8 !!! #define SDSS2pin 13 // on the UNO the Sparkfun SDSS pin is 8 !!! File anyFile // for logging day records File entry File root String fileName = "anyFile. The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards) or 50, 51, and 52 (Arduino Mega). script to deminstrate 2 x 16 LCD and 2 x SD card. In fact more than 2 SD cards can be attached this way as long as the CS pins are connected to different pins. When switching back to the first SD card, do a digitalWrite(13, HIGH) before the SD.begin(53).Īlso make sure to close any open files fileName.close() when data has been written to a file before switching to the other SD card. However, by doing a digitalWrite(53, HIGH) before the SD.begin(13), the first one is de-selected and the other SD card will be selected. In the sketch, only one SD card can be open at the same time, SD.begin(53). Note that the SD cards need 3.3 Volt as VCC but they cab handle 5V on the logical pins (or at least the ones I used). SD number 2, CS pin is connected to 13 (or any other unused digital pin). SD number 1, CS (chip-select) pin is connected to 53 and Attached the 2 SD cards as per standard instructions except for 1 pin: Also want to be able to copy a file from one SD card to another. Wanted to write 2 SD cards from one Arduino (Mega or other) with the SD library.
0 Comments
Leave a Reply. |