// When using hardware SPI, the SS pin MUST be set to an // output (even if not connected or used). If left as a // floating input w/SPI on, this can cause lockuppage.#if !defined(SOFTWARE_SPI)#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) if(chipSelect != 53) pinMode(53, OUTPUT); // SS on Mega#else if(chipSelect != 4) pinMode(4, OUTPUT); // SS on Uno, etc.#endif#endif

// Create an image with the name IMAGExx.JPG char filename[13]; strcpy(filename, "IMAGE.JPG"); // create if does not exist, do not open existing, write, sync after write if (! SD.exists(filename)) { return; }