if SD card removed, how to flag and restart?

I am looking to create a flag when the SD card is removed, and a restart condition short of the reset button. I tried checking when I call the routine, but for this Nube, I'm missing something. I moved the setup routine to the void, now it just hangs at card failed.

Thank you.

FYI: 240x320 2.8" TFT Shield driver 4535 for Arduino » Cee'z Blog, I did modify the Sd2Card.cpp ,Sd2Card.h libs. It was a good fix, just need to understand how to check for sd card present.

void UpdateLog()
   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!
  dataFile = SD.open("datalog.txt", FILE_WRITE);
  if (! dataFile) 
    Serial.println("error opening datalog.txt");
    // Wait forever since we cant write data
    while (1) ;
  // make a string for assembling the data to log:
  String dataString = "";

  int sensor = (actual);
  dataString += String(sensor);

  // print to the serial port too:
   tft.setCursor(30,50);  //Label



Card Detect. Either poll or use an interrupt. If you don't have access you can test by using the library, e.g. closing the file will fail. To restart SD you'll have to first modify the library so that you can call SD.begin() more than once. Or switch to SdFat which allows this without modification. If you had searched first you would have encountered many threads on the subject of card removal/insertion.

Or did you mean restarting your arduino? If so:

By the way, I believe the most common spelling is n00b, with zeros.

Thanks, but it's Nube..Or that could be a moot point or a mute point....

The search engine is pretty particular and could not find what I was looking for, but SDFat maybe the right solution. I will look into that.

I vote for noob ...

The search engine is pretty particular and could not find what I was looking for...

I almost never use the Arduino search engine. I go with google or bing and specify the site there.

For example, try typing this into google:

detect card removal site:forum.arduino.cc