mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Adding SD.remove(file) and another example.
This commit is contained in:
33
libraries/SD/examples/Files/Files.pde
Normal file
33
libraries/SD/examples/Files/Files.pde
Normal file
@ -0,0 +1,33 @@
|
||||
#include <SD.h>
|
||||
|
||||
File f;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
Serial.print("Initializing SD card...");
|
||||
SD.begin();
|
||||
Serial.println("done.");
|
||||
|
||||
if (SD.exists("example.txt")) Serial.println("example.txt exists.");
|
||||
else Serial.println("example.txt doesn't exist.");
|
||||
|
||||
Serial.println("Creating example.txt...");
|
||||
f = SD.open("example.txt", true);
|
||||
f.close();
|
||||
|
||||
if (SD.exists("example.txt")) Serial.println("example.txt exists.");
|
||||
else Serial.println("example.txt doesn't exist.");
|
||||
|
||||
Serial.println("Removing example.txt...");
|
||||
SD.remove("example.txt");
|
||||
|
||||
if (SD.exists("example.txt")) Serial.println("example.txt exists.");
|
||||
else Serial.println("example.txt doesn't exist.");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user