Codey Online › Libreria di componenti Arduino ed ESP32 › Micro-SD Card Reader 5V
Micro-SD Card Reader 5V
Memorizzazione

Micro-SD Card Reader 5V

Questo lettore di schede Micro-SD è un modulo con interfaccia SPI per accedere a una scheda microSD come memoria esterna. Si collega a un microcontrollore tramite il chip-select (CS) e i segnali SCK, MOSI e MISO, ed è alimentato da VCC con GND come riferimento.

Larghezza: 50.6 mm

Pinout — Micro-SD Card Reader 5V

Pin Segnale Descrizione
CS chip-select SPI chip-select for the microSD card interface, typically active low.
SCK SCK SPI serial clock from the host controller to the microSD card.
MOSI MOSI SPI data from host controller to the microSD card.
MISO MISO SPI data from the microSD card back to the host controller.
VCC power Power input for the microSD adapter module, typically 5V on this board.
GND ground Ground reference for power and SPI signals.

Schema di cablaggio di esempio — Micro-SD Card Reader 5V

Da A Filo
board:D10 x1:CS green
board:D13 x1:SCK blue
board:D11 x1:MOSI yellow
board:D12 x1:MISO purple
board:5V x1:VCC red
board:GND x1:GND black

Codice Arduino di esempio — Micro-SD Card Reader 5V

Questo esempio è stato scritto e verificato in compilazione per arduino-uno. Codey Online lo adatta a qualsiasi altra scheda supportata.

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

const int SD_CS_PIN = 10;

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }

  Serial.println("Initializing microSD card reader...");

  pinMode(SD_CS_PIN, OUTPUT);
  digitalWrite(SD_CS_PIN, HIGH);

  if (!SD.begin(SD_CS_PIN)) {
    Serial.println("Card initialization failed. Check wiring and ensure a formatted microSD card is inserted.");
    while (true) {
      delay(1000);
    }
  }

  Serial.println("Card initialized successfully.");

  File root = SD.open("/");
  if (root) {
    Serial.println("Files on the card:");
    printDirectory(root, 0);
    root.close();
  } else {
    Serial.println("Could not open root directory.");
  }
}

void loop() {
  // This example only initializes the card and lists the root directory once.
  delay(1000);
}

void printDirectory(File dir, int numTabs) {
  while (true) {
    File entry = dir.openNextFile();
    if (!entry) {
      break;
    }

    for (int i = 0; i < numTabs; i++) {
      Serial.print('\t');
    }

    Serial.print(entry.name());
    if (entry.isDirectory()) {
      Serial.println("/");
      printDirectory(entry, numTabs + 1);
    } else {
      Serial.print("\t\t");
      Serial.println(entry.size(), DEC);
    }
    entry.close();
  }
}

Componenti correlati

Micro SD Card Adapter Module 3.3V

Micro SD Card Adapter Module 3.3V

Micro-SD Card Reader 3.3V

Micro-SD Card Reader 3.3V

RFID RC522 Module 13.56MHz

RFID RC522 Module 13.56MHz

1.28" Round TFT LCD 240x240 (GC9A01, SPI)

1.28" Round TFT LCD 240x240 (GC9A01, SPI)

Crea il tuo progetto Arduino o ESP32 con l'AI

Descrivi cosa vuoi realizzare. Codey Online scrive il codice, disegna lo schema di collegamento, lo compila e programma la tua scheda direttamente dal browser.

Inizia gratis