Removed old sdCard test
This commit is contained in:
parent
1dfe399d56
commit
48991fe12e
@ -1,75 +0,0 @@
|
|||||||
#include "definition.h"
|
|
||||||
#include "PinMapping.h"
|
|
||||||
#include "SAB.h"
|
|
||||||
|
|
||||||
SAB sab;
|
|
||||||
|
|
||||||
File f,g;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// put your setup code here, to run once:
|
|
||||||
Serial.println("Starting setup");
|
|
||||||
//Testing if directory exists :
|
|
||||||
if(!sab.getSdCardManager().exists("test/doesnotexist"))
|
|
||||||
Serial.println("The directory does not exist");
|
|
||||||
else
|
|
||||||
Serial.println("The directory does exist");
|
|
||||||
|
|
||||||
if(!sab.getSdCardManager().mkdir("test"))
|
|
||||||
Serial.println("Failed to create test dir");
|
|
||||||
|
|
||||||
if(!sab.getSdCardManager().exists("test"))
|
|
||||||
Serial.println("The directory does not exist");
|
|
||||||
else
|
|
||||||
Serial.println("The directory does exist");
|
|
||||||
|
|
||||||
f = sab.getSdCardManager().open("test/doesnotexist.txt");
|
|
||||||
if(f == NULL) Serial.println("Unable to open file doesnotexist.txt");
|
|
||||||
|
|
||||||
f = sab.getSdCardManager().open("test/exist.txt", FILE_WRITE);
|
|
||||||
if(f == NULL) Serial.println("Unable to open file exist.txt");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char text[] = "I am the file's content.\nHere is a new Line";
|
|
||||||
f.write(text, strlen(text));
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
f = sab.getSdCardManager().open("test/exist.txt");
|
|
||||||
if(f == NULL) Serial.println("Unable to open file exist.txt");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Serial.println("File content :");
|
|
||||||
while(f.available())
|
|
||||||
{
|
|
||||||
char c = f.read();
|
|
||||||
Serial.print(c);
|
|
||||||
}
|
|
||||||
Serial.println();
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!sab.getSdCardManager().remove("test/exist.txt"))
|
|
||||||
Serial.println("Failed to remove file");
|
|
||||||
else
|
|
||||||
Serial.println("Deleted successfully");
|
|
||||||
|
|
||||||
f = sab.getSdCardManager().open("several");
|
|
||||||
if(f == NULL) Serial.println("Unable to open file several");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Serial.println("dir content :");
|
|
||||||
while((g = f.openNextFile()) != 0)
|
|
||||||
{
|
|
||||||
Serial.println(g.name());
|
|
||||||
}
|
|
||||||
Serial.println();
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.println("End setup");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user