Codey OnlineArduino- & ESP32-Komponentenbibliothek › Micro-SD Card Reader 5V
Micro-SD Card Reader 5V
Sensoren

Micro-SD Card Reader 5V

Dieser Micro-SD-Kartenleser ist ein SPI-Interface-Modul zum Zugriff auf eine microSD-Karte als externen Speicher. Er wird über Chip-Select (CS) sowie die Signale SCK, MOSI und MISO mit einem Mikrocontroller verbunden und über VCC versorgt, mit GND als Bezug.

Breite: 50.6 mm

Pinbelegung — Micro-SD Card Reader 5V

Pin Signal Beschreibung
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.

Beispielschaltplan — Micro-SD Card Reader 5V

Von Nach Kabel
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

Arduino-Beispielcode — Micro-SD Card Reader 5V

Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.

#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();
  }
}

Ähnliche Komponenten

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Bau dein Arduino- oder ESP32-Projekt mit AI

Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.

Kostenlos starten