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.
Fork of HelloWorld by
Diff: main.cpp
- Revision:
- 2:8f518d957e27
- Parent:
- 0:fb6bbc10ffa0
--- a/main.cpp Sun Jan 01 20:57:57 2012 +0000 +++ b/main.cpp Thu Mar 03 14:18:44 2016 +0000 @@ -1,12 +1,26 @@ #include "mbed.h" +#include "flashLED.h" -DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); // tx, rx + +LocalFileSystem local("local"); int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + char buffer[128]; + FILE *fp = fopen("/local/sample.txt", "r"); + if(fp==NULL){ + pc.printf("Error opening file.\n"); } + + while(fgets(buffer,sizeof(buffer), fp)!=NULL){ + FlashAll(); + for(int i=0;i<7;i++){ + pc.printf("%c", buffer[i]); + } + } + + pc.printf("\n"); + pc.printf("All commands sent.\n"); + pc.printf("\n"); + fclose(fp); }