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.
main.cpp
- Committer:
- mbed68244
- Date:
- 2014-05-28
- Revision:
- 1:a770d742e28a
- Parent:
- 0:253a9226eb5b
- Child:
- 2:153ec87771a0
File content as of revision 1:a770d742e28a:
#include "mbed.h" #include <fstream> #define PACKET_COUNT 4 Serial pc(USBTX, USBRX); // tx, rx DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4); LocalFileSystem local("local"); // Create the local filesystem under the name "local" int read_buffer[100][20]; int main() { myled4 = 1; int index = 0; int num_packets = 0; FILE *fp = fopen("/local/packet.txt", "w"); for(; num_packets < PACKET_COUNT; num_packets++){ for(; index < 19; index++){ read_buffer[num_packets][index] = pc.getc() - 48; fprintf(fp,"%d",read_buffer[num_packets][index]); if(index == 1) fprintf(fp,"."); if(index == 5) fprintf(fp,"."); if(index == 9) fprintf(fp,"."); if(index == 16) fprintf(fp,"."); if(index == 18) fprintf(fp,"."); } index = 0; fprintf(fp,"\n"); } fclose(fp); myled1 = 1; }