From f12d265653719924d59c774312ff506dc16ea261 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Thu, 9 May 2013 11:14:59 +0200 Subject: Bridge lib moved bridge branch embedded into ide discovery branch --- libraries/Bridge/examples/FileTest/FileTest.ino | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 libraries/Bridge/examples/FileTest/FileTest.ino (limited to 'libraries/Bridge/examples/FileTest/FileTest.ino') 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 + +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() { +} + + + -- cgit v1.2.3-18-g5258