USB Flash Drive: how to avoid the restart when the USB flash memory stick is unplugged

Hello,

It it possible to avoid the Giga restart when the USB memory stick is unplugged?

I loose also all the values in the memory of the Giga.

Thanks.

Any program that writes to a USB card must close the file properly BEFORE the card is removed. So, figure out a way and the code to close the card file so it can be removed, properly.

I will light the internal LED in green when the USB memory is in read/write mode. Thanks!

msd.connect() make the board to restart instead of continuing the loop when the memory stick is back in the USB port.