Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ExoController MODSERIAL SDFileSystem_HelloWorld UI-Honka mbed
Fork of Data Management by
Diff: main.cpp
- Revision:
- 9:26e200175e0e
- Parent:
- 8:f8fd59fe3e11
- Child:
- 10:057620949ce1
--- a/main.cpp Sat Feb 14 00:38:04 2015 +0000
+++ b/main.cpp Wed Feb 18 01:11:47 2015 +0000
@@ -9,18 +9,19 @@
bool check_errfile()
{
- printf("checking errfile\r\n");
+ //printf("checking errfile\r\n");
/* This line causes error, reason unknown */
int *errors = new int[1];
- printf("about to open errfile for reading");
err.open_for_read("/sd/", "error.txt");
+
+ //printf("Opened ERR for reading\r\n");
err.read_from_start(1, errors);
err.close();
- printf("Errors[0]: %d\r\n", errors[0]);
+ //printf("Errors[0]: %d\r\n", errors[0]);
if (errors[0] == 1) {
return false;
}
- printf("Sucess--no errors detected\r\n");
+ // printf("Sucess--no errors detected\r\n");
return true;
}
@@ -29,15 +30,15 @@
int testArray[] = {1, 2, 3, 4};
//int badArray[] = {1,2,3,3};
int *output = new int[4];
- printf("created output array\r\n");
+ //printf("created output array\r\n");
testFile.write(4, testArray);
- printf("wrote to testfile\r\n");
+ //printf("wrote to testfile\r\n");
//testFile.write(4, badArray);
testFile.read(4, output);
- printf("read to output\r\n");
+ //printf("read to output\r\n");
for (int i = 0; i < 4; i++) {
if (testArray[i] != output[i]) {
- printf("ERROR--test read failed\r\n");
+ //printf("ERROR--test read failed\r\n");
int error[] = {0x0001};
//err("/sd/", "error.txt", true);
err.open_for_write("/sd/", "error.txt");
@@ -45,14 +46,18 @@
int *check = new int[1];
err.read_from_start(1, check);
err.close();
- printf("%d writtten to ERR\r\n", check[0]);
+ //printf("%d writtten to ERR\r\n", check[0]);
return false;
}
}
- pc.printf("Success! Test read worked\r\n");
+ //pc.printf("Success! Test read worked\r\n");
return true;
}
/**
+void attachment() {
+ phone.attachment();
+}
+
int main() {
// check_sdcard();
// int[] errors = new int[10];
@@ -61,10 +66,10 @@
//stop startup;
//}
printf("Hello world!\r\n");
- pc.baud(9600);
+ // pc.baud(9600);
interrupt.attach(&attachment, 0.002);
}
-
+/**
int main()
{
pc.printf("ENTERING MAIN\r\n");
@@ -77,9 +82,9 @@
int main()
{
- printf("ENTERING MAIN\r\n");
+ //printf("ENTERING MAIN\r\n");
if (!check_errfile() || !check_sdcard()) {
- // if (!check_sdcard()) {
+ //if (!check_sdcard()) {
printf("Check failed...aborting power-on\r\n");
return 1;
}
