/*
The circuit:
   SD card attached to SPI bus as follows:
 ** MOSI - pin 11    
 ** MISO - pin 12  
 ** SCK  - pin 13  SCK (Serial ClocK) and CLK (CloCK) are two different acronyms for the same thing.
 ** CS   - pin 4.
  created  22 December 2010
  by Limor Fried
  modified 9 Apr 2012
  by Tom Igoe
  modified 21. July 2021
  by Martin Hruska
  This example code is in the public domain.
*/
#include <SD.h>
const int chipSelect = 4;

void setup() 
{
  // Open serial communications and wait for port to open:
   Serial.begin(76800);
    while (!Serial) {
    ; // wait for Serial Monitor to connect. Needed for native USB port boards only:
   }
  Serial.print("Initializing SD card...");
  pinMode (10, OUTPUT);
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    Serial.println("Initialization failed. Things to check:");
    Serial.println("1. Is a card inserted?");
    Serial.println("2. Is your wiring correct?");
    Serial.println("3. Did you change the chipSelect pin to match your shield or module?");
    while (true);
  }
  Serial.println("Card initialized.");
}
void loop() {
  // Open the file. Note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("Song.wav");
  if (dataFile) {
    while (dataFile.available()) {
      Serial.write(dataFile.read());
    }
    dataFile.close ();
  }
   // if the file isn't open, pop up an error:
  else {
    Serial.println("Error opening Song.wav");
  }
}
