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
main.cpp
- Committer:
- micbio
- Date:
- 2016-12-05
- Revision:
- 1:58d2021e301d
- Parent:
- 0:1649f66cf32a
- Child:
- 2:e699312248f3
File content as of revision 1:58d2021e301d:
#include "mbed.h"
#include "SDFileSystem.h"
#include "cli.hpp"
#include "file_manager.hpp"
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();
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");
fclose(fp);
wait(1);
}
}