Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: SD lib:SD.exists() returns TRUE if SD is removed on: January 19, 2011, 07:34:56 am
The reason you cannot call begin repeatedly is the the root file object is still open. If you add a root.close() to the begin routine in SD.cpp then you can use begin repeatedly and verify the presence of a card.

boolean SDClass::begin(uint8_t csPin) {

    Performs the initialisation required by the sdfatlib library.

    Return true if initialization succeeds, false otherwise.

  if (root.isOpen()) root.close();      // allows repeated calls
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
Pages: [1]