title: Data are not saved in the Arduino SD
body: <p>I have created a code that takes temperature measurement data and saves it in a variable. Now I would like to save the data in a .txt file inside an SD card connected to Arduino. The initialization of the SD works, but when it manages to access the file it gives me errors, writing me a set of strange symbols instead of the file name and it doesn't write inside the file. I tried a very similar code to write inside the SD and it works fine. What problem can it be? I enclose the part of the writing code on the SD and the photo with the output.
  Initialization part:</p>
  <pre><code>Serial.println(F(&quot;Intializing SD card&quot;));
  if(!SD.begin(4))
  {
    Serial.print(F(&quot;Initialization failed&quot;));
    while(!SD.begin(4))
    {
      Serial.print(F(&quot;.&quot;));
      delay(1000);
    }
  }
  else Serial.println(F(&quot;Initialization done&quot;));
  </code></pre>
  <p>Writing part:</p>
  <pre><code>sdFile = SD.open(&quot;records.txt&quot;,FILE_WRITE);
  Serial.print(&quot;Writing to &quot;);
  Serial.println(sdFile.name());
  sdFile.print(&quot; Temperature: &quot;);
  sdFile.print(tempC);
  sdFile.print(&quot; taken at: &quot;);
  sdFile.print(hour());
  sdFile.print(&quot;:&quot;);
  sdFile.print(minute());
  sdFile.print(&quot;:&quot;);
  sdFile.println(second());
  
  sdFile.close();
  </code></pre>
  <p><a href="https://i.stack.imgur.com/gnNBc.png" rel="nofollow noreferrer">Image with the strange output</a></p>