background image

 

 

 

 

 6 

 

 

 

 

  // we'll use the initialization code from the utility libraries 

 

  // since we're just testing if the card is working! 

 

  if (!card.init(SPI_HALF_SPEED, chipSelect)) { 

 

    Serial.println("initialization failed. Things to check:"); 

 

    Serial.println("* is a card inserted?"); 

 

    Serial.println("* is your wiring correct?"); 

 

    Serial.println("* did you change the chipSelect pin to match your shield or module?"); 

 

    while (1); 

 

  } else { 

 

    Serial.println("Wiring is correct and a card is present."); 

 

  } 

 

 

 

  // print the type of card 

 

  Serial.println(); 

 

  Serial.print("Card type:         "); 

 

  switch (card.type()) { 

 

    case SD_CARD_TYPE_SD1: 

 

      Serial.println("SD1"); 

 

      break; 

 

    case SD_CARD_TYPE_SD2: 

 

      Serial.println("SD2"); 

 

      break; 

 

    case SD_CARD_TYPE_SDHC: 

 

      Serial.println("SDHC"); 

 

      break; 

 

    default: 

 

      Serial.println("Unknown"); 

 

  } 

 

 

 

  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32 

 

  if (!volume.init(card)) { 

 

    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the 
card"); 

 

    while (1); 

 

  } 

 

 

 

  Serial.print("Clusters:          "); 

 

  Serial.println(volume.clusterCount()); 

 

  Serial.print("Blocks x Cluster:  "); 

 

  Serial.println(volume.blocksPerCluster()); 

 

 

 

  Serial.print("Total Blocks:      "); 

 

  Serial.println(volume.blocksPerCluster() * volume.clusterCount()); 

 

  Serial.println(); 

 

 

 

  // print the type and size of the first FAT-type volume 

 

  uint32_t volumesize; 

 

  Serial.print("Volume type is:    FAT"); 

 

  Serial.println(volume.fatType(), DEC); 

 

 

Содержание Whadda WPI304

Страница 1: ...USER MANUAL EN SD card logging module for Arduino WPI304 whadda com...

Страница 2: ...ons with reduced physical sensory or mental capabilities or lack of experience and knowledge if they have been given supervision or instruction concerning the use of the device in a safe way and under...

Страница 3: ...n Wiring and the Arduino software IDE based on Processing Additional shields modules components are required for reading a twitter message or publishing online Surf to www arduino cc for more informat...

Страница 4: ...4 Connection Connection to Arduino Uno Arduino WPI304 10 CS 11 MOSI 12 MISO 13 SCK GND GND 5V 5 V Connection to Arduino Mega Arduino WPI304 50 MISO 51 MOSI 52 SCK 53 CS GND GND 5V 5 V...

Страница 5: ...reated 28 Mar 2011 by Limor Fried modified 9 Apr 2012 by Tom Igoe modified 4 Sept 2020 by Midas Gossye Velleman include the SD library include SPI h include SD h set up variables using the SD utility...

Страница 6: ...YPE_SD1 Serial println SD1 break case SD_CARD_TYPE_SD2 Serial println SD2 break case SD_CARD_TYPE_SDHC Serial println SDHC break default Serial println Unknown Now we will try to open the volume parti...

Страница 7: ...locks are 1KB Serial print Volume size Kb Serial println volumesize Serial print Volume size Mb volumesize 1024 Serial println volumesize Serial print Volume size Gb Serial println float volumesize 10...

Страница 8: ...8 whadda com Modifications and typographical errors reserved Velleman Group nv WPI304_v01 Velleman Group nv Legen Heirweg 33 9890 Gavere...

Отзывы: