Read Data on a Micro-SD Card with a Seeeduino Xiao

Description: A Micro-SD Card Module connected to a Seeeduino Xiao opens the data.txt file on the Micro-SD Card and then reads and outputs that data onto the Serial Monitor.

Read Data on a Micro-SD Card with Seeeduino Xiao

Notes: Open the Serial Monitor and set the Baud Rate to 9600 in order to see the incoming data as in the picture below.

Read Data from Micro-SD Card to Serial Monitor

Supplies:

1 – Breadboard 400 Points   >> Link <<
1 – Seeeduino Xiao   >> Link <<
1 – Micro-SD Card Module   >> Link <<

Arduino Code:

#include <SPI.h>
#include <SD.h>

File myFile;

void setup() {
  
Serial.begin(9600);

while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

if (!SD.begin(3)) {
  
Serial.println("Initialization Failed!");
while (1);

}

myFile = SD.open("data.txt"); // open the file for reading

if (myFile) {

while (myFile.available()) {
  
Serial.write(myFile.read());

}

myFile.close(); 

} else {
  
Serial.println("error opening data.txt"); 

}
}

void loop() {

}

Leave a Comment

20 − 11 =