CSE237B_Team / Mbed 2 deprecated read_serial

Dependencies:   mbed-rtos mbed

main.cpp

Committer:
mbed68244
Date:
2014-05-28
Revision:
0:253a9226eb5b
Child:
1:a770d742e28a

File content as of revision 0:253a9226eb5b:

#include "mbed.h"
#include <fstream>

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() {
    int index = 0; 
    FILE *fp = fopen("/local/packet.txt", "w");    
    for(; index < 10; index++){
     read_buffer[0][index] = pc.getc();
     fprintf(fp,"%d",read_buffer[0][index]);
     fprintf(fp,".");
     
     if(index%2 == 0){
     myled1 =1;
     myled2 = 0;
     }
     else{
       myled1 =0;
     myled2 = 1;   
         }
     
     
     }
    fclose(fp);
    myled1 = 1;
    
}