»óÇ°Ä«Å×°í¸® > Àü±âºÎÇ°/¸ðµâ > SD/TF/MicroSD

SDÄ«µå ¸®´õ ¸ðµâ (Arduino SDCard Reader Module) / SD Card Reader
ÆǸŰ¡°Ý : 3,190¿ø (ºÎ°¡¼¼ Æ÷ÇÔ)
»óÇ°ÄÚµå : [7632]ZAS-MIZ-7361
Á¦Á¶»ç : OEM
±¸¸Å¼ö·® : ÀϽÃÇ°ÀýµÈ »óÇ°ÀÔ´Ï´Ù. (ÁÖ¹®: 053-588-4080)
ÃÑ ±Ý¾× :

  • »óÇ°»ó¼¼
  • °ü·Ã»óÇ°
  • ¹è¼Û/±³È¯/¹ÝÇ° ¾È³»
  • »óÇ°¸®ºä

SDÄ«µåÀÇ µ¥ÀÌÅ͸¦ ÀÐ°í ¾²±â°¡ °¡´ÉÇÑ ¸ðµâÀÔ´Ï´Ù.

SPIÅë½ÅÀ» »ç¿ëÇÕ´Ï´Ù.


¿¬°á¹ý

  • 5V and Ground
  • CS stands for Chip Select also known as SS- and should be connected to pin10 on the arduino.
  • MOSI is also know as DI and is connected to pin 11
  • MISO is also known as DO and is connected to pin 12
  • SCK is also known as CLK and should be connected to pin 13.

SD ¶óÀ̺귯¸®´Â Adafruit À¥»çÀÌÆ®¿¡¼­ ´Ù¿î·Îµå ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.

https://github.com/adafruit/SD


¼Ò½º ÄÚµå

/*

 Requires the SD library from the Adafruit website

 * SD card attached MOSI - pin 11, MISO - pin 12, CLK - pin 13, CS - pin 10

*/


#include


const int chipSelect = 10;


File dataFile;


void setup()

{

  // Open serial communications and wait for port to open:

  Serial.begin(57600);

  while (!Serial) {

    ; // wait for serial port to connect. Needed for Leonardo only

  }

  Serial.print("Initializing SD card...");

  // make sure that the default chip select pin is set to

  // output, even if you don't use it:

  pinMode(SS, OUTPUT);


  // see if the card is present and can be initialized:

  if (!SD.begin(chipSelect)) {

    Serial.println("Card failed, or not present");

    // don't do anything more:

    while (1) ;

  }

  Serial.println("card initialized.");


  // Open up the file we're going to log to!

  // create a new file

  char filename[] = "LOGGER00.TXT";

  for (uint8_t i = 0; i < 100; i++) {

    filename[6] = i / 10 + '0';

    filename[7] = i % 10 + '0';

    if (! SD.exists(filename)) {

      // only open a new file if it doesn't exist

      dataFile = SD.open(filename, FILE_WRITE);

      break;  // leave the loop!

    }

  }


  if (! dataFile) {

    Serial.println("couldnt create file");

  }

  Serial.print("Logging to: ");

  Serial.println(filename);

}


int i = 0;  //Use this for the counter

void loop()

{

  // make a string for assembling the data to log:

  String dataString = "";

  // read three sensors and append to the string:

  for (int analogPin = 0; analogPin < 3; analogPin++) {

    int sensor = analogRead(analogPin);

    dataString += String(sensor);

    if (analogPin < 2) {

      dataString += ",";

    }

  }

  dataFile.println(dataString);

  // print to the serial port too:

  //Serial.println(' ');

  // The line dataFile.flush() will 'save' the file to the SD card after every

  // line of data - this will use more power and slow down how much data

  // you can read but it's safer!

  // If you want to speed up the system, call flush() less often and it

  // will save the file only when called and every 512 bytes - every time a sector on the

  // SD card is filled with data. However, don't depend on the automatic flush!

  i++;

  if (i > 50) { //Call every 50 times

    dataFile.flush();

    i = 0;

  }

  // Take 1 measurement every 10 milliseconds

  delay(10);

}

¸ÞÄ«¸®¿öÁî






°ßÀû¿äû
±¸¸Å´ëÇà
Äü/¹æ¹®¼ö·É
ÈĺҰáÁ¦
±â¼ú¹®ÀÇ