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: EthernetInterface SDFileSystem mbed-rtos mbed
Diff: main.cpp
- Revision:
- 1:58d2021e301d
- Parent:
- 0:1649f66cf32a
- Child:
- 2:e699312248f3
diff -r 1649f66cf32a -r 58d2021e301d main.cpp
--- a/main.cpp Sat Dec 03 23:49:02 2016 +0000
+++ b/main.cpp Mon Dec 05 01:07:30 2016 +0000
@@ -1,9 +1,59 @@
#include "mbed.h"
#include "SDFileSystem.h"
+#include "cli.hpp"
+#include "file_manager.hpp"
-SDFileSystem sd(p11, p12, p13, p10, "sd");
+SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS
+Serial pc(USBTX, USBRX);
+// DigitalIn enable(SW2);
+DigitalOut led(LED1);
+
+int main()
+{
+ cli_sd cli;
+ file_manager fm;
+ char cmd;
+
+ cli::print_help();
-int main() {
+ while(1)
+ {
+ cmd = cli::get_cmd();
+
+ switch(cmd)
+ {
+ case 'm':
+ break;
+ case 'p':
+ fm::set_path();
+ break;
+ case 'w':
+ fm::write_to_file();
+ break;
+ case 'a':
+ fm::append_to_file();
+ break;
+ case 'r':
+ fm::read_from_file();
+ break;
+ default:
+ pc::printf("Error.\n"); // should never enter this
+ break;
+ }
+ }
+
+ while(1) {
+ if(!enable.read()) {
+ //pc.printf("\r\nThis is: %c", cmd);
+ //pc.scanf(cmd);
+ if (pc.writeable())
+ {
+ led = !led;
+ }
+ }
+ wait(0.25);
+ }
+
while(1) {
FILE *fp = fopen("/sd/testfile.txt", "a");
fprintf(fp, "hello world!\n");