SD kaart module lezen/schrijven SPI

(3 klantbeoordelingen)

1,25

SD Data logging Module.

36 op voorraad

SKU: HE0139-001 Categorie: Tags: , , , , Verzenden:

Beschrijving

Deze SD kaart module is een kant en klare oplossing om data naar een SD card te schrijven of te lezen van een SD kaart. Werkt op 3.3 of 5V en aan te sluiten via SPI. Voor bijvoorbeeld het loggen van weer gegevens of extra opslag voor je mp3 module.

SD kaart module specificatie’s:
– Werkt op: 3.3V of 5V.
– Geschikt voor: SD/SDHC cards (niet meegeleverd).
– Interface: SPI.

Arduino code voorbeeld:

Arduino library

/*
 SD module example
 
 This example shows how to read and write data to and from an SD card file
 and how to create and destroy an SD card file
 The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 10
 
 created   Nov 2010
 by David A. Mellis
 updated 2 Dec 2010
 by Tom Igoe
 
 This example code is in the public domain.
      
 */
 
#include < SD.h >

// define the pin that powers up the SD card
#define MEM_PW 8

File myFile;

void setup()
{
  Serial.begin(9600);
  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
 
  // on my MicroSD Module the power comes from a digital pin
  // I activate it at all times
   pinMode(MEM_PW, OUTPUT);
   digitalWrite(MEM_PW, HIGH);
  
  if (!SD.begin(10)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
 
  //delete old file
    SD.remove("example.txt");
   
  // Check to see if the file exists:
  if (SD.exists("example.txt")) {
    Serial.println("example.txt exists.");
   
  }
  else {
    Serial.println("example.txt doesn't exist.");
  }
 
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("example.txt", FILE_WRITE);
 
  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to example.txt...");
    myFile.println("testing 1, 2, 3.");
    // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening example.txt");
  }
 
   // Check to see if the file exists:
  if (SD.exists("example.txt")) {
    Serial.println("example.txt exists.");
  }
  else {
    Serial.println("example.txt doesn't exist."); 
  }
 
  // re-open the file for reading:
  myFile = SD.open("example.txt");
  if (myFile) {
    Serial.println("example.txt:");
   
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
        Serial.write(myFile.read());
    }
   
    //Delay to enable the user to stop the secuence
    Serial.println("if you want disconnect SD card ");
    delay(10000);
   
   
    // close the file:
    myFile.close();
  } else {
      // if the file didn't open, print an error:
    Serial.println("error opening example.txt");
  }
  // delete the file:
  Serial.println("Removing example.txt...");
  SD.remove("example.txt");

  if (SD.exists("example.txt")){
    Serial.println("example.txt exists.");
  }
  else {
    Serial.println("example.txt doesn't exist."); 
  }
}

void loop()
{
    // nothing happens after setup
}

3 beoordelingen voor SD kaart module lezen/schrijven SPI

  1. Peter (geverifieerde eigenaar)

    Goede en goedkope sd reader.
    Leest en schrijft aardig snel. (snel genoeg voor tekstbestanden)

    Wil hem binnenkort gaan testen hoe snel hij is met muziek afspelen.

  2. benjaminvanzwienen@live.nl (geverifieerde eigenaar)

    Uitstekende prijs/kwaliteitsverhouding. Gebruikt om de temperatuur te loggen. Makkelijk dat een .txt bestand direct in Excel geopend kan worden.

  3. Electronics4Fun (geverifieerde eigenaar)

    Deze Sd module werkt bij mij prima met de standaard Arduino SD-Library en een standaard sd-kaartje van 8 gb Fat32 zo uit de verpakking. Tip: bij gebruik van datalogging, bestand wegschrijven als .csv

Enkel ingelogde klanten die dit product gekocht hebben, mogen een beoordeling schrijven.

Verzending binnen Nederland

Dit product word bezorgd via PostNL briefpost in een bubbel envelop.
- € 3.45 verzendkosten voor orders onder de € 25,-.
- € 2.95 verzendkosten voor orders tussen € 25 - 45,-.
- Orders boven de € 45,- worden gratis verstuurd per PostNL briefpost.

  • Op werkdagen voor 16:30 uur besteld, zelfde dag verzonden!
    Klik hier voor de kosten buiten Nederland.
  • Product vraag?

      Uw naam (verplicht)

      Uw email (verplicht)

      Uw vraag

      Andere suggesties…