CSE237B_Team / Mbed 2 deprecated read_serial

Dependencies:   mbed-rtos mbed

Revision:
0:253a9226eb5b
Child:
1:a770d742e28a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 28 03:46:38 2014 +0000
@@ -0,0 +1,36 @@
+#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;
+    
+}