diff options
author | Federico Fissore <f.fissore@arduino.cc> | 2013-05-09 11:14:59 +0200 |
---|---|---|
committer | Federico Fissore <f.fissore@arduino.cc> | 2013-05-09 11:15:36 +0200 |
commit | f12d265653719924d59c774312ff506dc16ea261 (patch) | |
tree | e6f099dcd4ad103177cab601daa5d7319450ba84 /libraries/Bridge/examples/FileTest | |
parent | 48eb4551dcde6eb40574d1d7cb41075c09339ccc (diff) |
Bridge lib moved bridge branch embedded into ide discovery branch
Diffstat (limited to 'libraries/Bridge/examples/FileTest')
-rw-r--r-- | libraries/Bridge/examples/FileTest/FileTest.ino | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libraries/Bridge/examples/FileTest/FileTest.ino b/libraries/Bridge/examples/FileTest/FileTest.ino new file mode 100644 index 0000000..3fd7ce9 --- /dev/null +++ b/libraries/Bridge/examples/FileTest/FileTest.ino @@ -0,0 +1,50 @@ + +#include <FileIO.h> + +void setup() { + Bridge.begin(); + SD.begin(); + + boolean r; + r=SD.exists("/arduino/test"); + if (r) error("1"); + r=SD.exists("/arduino"); + if (!r) error("2"); + + r=SD.mkdir("/arduino/test"); + if (!r) error("3"); + r=SD.exists("/arduino/test"); + if (!r) error("4"); + + File f = SD.open("/arduino/test/bla", FILE_WRITE); + if (!f) error("5"); + f.println("CIAO!"); + f.close(); + + delay(10000); + + r=SD.rmdir("/arduino/test"); + if (r) error("6"); + r=SD.remove("/arduino/test"); + if (r) error("7"); + + r=SD.remove("/arduino/test/bla"); + if (!r) error("8"); + r=SD.rmdir("/arduino/test"); + if (!r) error("9"); + r=SD.exists("/arduino/test"); + if (r) error("10"); +} + + +void error(const char *s) { + Bridge.print("# ERROR "); + Bridge.println(s); + while (true); +} + +void loop() { +} + + + |