   }
   else if((temp == 0xD8) & (temp_last == 0xFF))
   {
-    Serial.println(F("ACK IMG"));
+    Serial.println(F("ACK IMG END"));
     is_header = true;
     Serial.write(temp_last);
     Serial.write(temp);

    case 0:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_320x240);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_320x240"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_320x240);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_320x240"));
    #endif
    temp=0xff;
    break;
    case 1:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_352x288);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_352x288"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_640x480);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_640x480"));
    #endif
    temp=0xff;
    break;
    case 2:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_640x480);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_640x480"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_1024x768);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_1024x768"));
    #endif
    temp=0xff;
    break;
    case 3:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_800x480);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_800x480"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_1280x960);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_1280x960"));
    #endif
    temp=0xff;
    break;
    case 4:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_1024x768);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_1024x768"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_1600x1200);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_1600x1200"));
    #endif
    temp=0xff;
    break;
    case 5:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_1280x960);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_1280x960"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_2048x1536);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_2048x1536"));
    #endif
    temp=0xff;
    break;
    case 6:
    #if defined (OV5640_MINI_5MP_PLUS)
      myCAM1.OV5640_set_JPEG_size(OV5640_1600x1200);delay(1000);
      Serial.println(F("ACK CMD switch to OV5640_1600x1200"));
    #else
      myCAM1.OV5642_set_JPEG_size(OV5642_2592x1944);delay(1000);
      Serial.println(F("ACK CMD switch to OV5642_2592x1944"));
    #endif
    temp=0xff;
    break;
    #if defined (OV5640_MINI_5MP_PLUS)
    case 7:
    myCAM1.OV5640_set_JPEG_size(OV5640_2048x1536);delay(1000);
    Serial.println(F("ACK CMD switch to OV5640_2048x1536"));
    temp=0xff;
    break;
    case 8:
    myCAM1.OV5640_set_JPEG_size(OV5640_2592x1944);delay(1000);
    Serial.println(F("ACK CMD switch to OV5640_2592x1944"));
    temp=0xff;
    break;
    #endif

    myCAM1.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid);
    myCAM1.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid);
    if ((vid != 0x56) || (pid != 0x42)){
      Serial.println(F("ACK CMD Can't find OV5642 module! END"));
      delay(1000);continue;
    }else{
      Serial.println(F("ACK CMD OV5642 detected. END"));break;
    }    
  }  
#endif
