This example shows how to create and destroy a file on a SD card. Please click here for more information on the SD library.
The Arduino or Genuino board has to be connected to the Ethernet Shield and also has a USB cable connected to the computer.
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the
SD.begin() names pin 4 as the CS pin. This pin varies depending on the make of shield or board you are using.
setup(), open a new file with
SD.open() named "example.txt".
FILE_WRITE enables read and write access to the file, starting at the end. In this example though, immediately close the file by calling
After checking to make sure the file exists with
SD.exists(), delete the file from the card with
Last revision 2015/08/18 by SM