For shosho

Dependencies:   BufferedSerial MODSERIAL mbed

Revision:
0:fa959cfb1d04
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 21 17:35:00 2016 +0000
@@ -0,0 +1,64 @@
+#include "mbed.h"
+#include "BufferedSerial.h"
+Serial pc(USBTX,USBRX);
+BufferedSerial BP(p13,p14);
+
+
+
+
+int main() {
+    
+    BP.baud(9600);
+    BP.format(8,SerialBase::None,2);
+
+       while(1)
+       {
+           
+      const char wakeup[]={0x55};       
+      const  char commUp[] = {0x2, 0x43, 0x50, 0x43, 0x30, 0x35, 0x3B};
+      const  char measure[] = {0x02, 0x43, 0x50, 0x43, 0x34, 0x30, 0x3A};
+      char record[8];
+      char record2[8];
+      
+      if (BP.writeable())          
+         BP.write(wakeup,sizeof(wakeup));
+         wait(1);
+         
+           
+         record[1]=BP.getc(); 
+          pc.printf("First Command Byte Response: %x \n\r",record[1]); 
+          wait(1);
+          pc.printf("\e[1;1H\e[2J");
+          
+        
+          
+        if (BP.writeable()) 
+        BP.write(commUp,sizeof(commUp));
+         
+         wait(5);
+         
+         for(int i=0;i<=7;i++) {
+          record[i]=BP.getc(); 
+          pc.printf("commUP Command Response: %x \n\r",record[i]); }
+          
+          if (BP.writeable()) 
+        BP.write(measure,sizeof(measure));
+         
+         wait(3);
+         
+         for(int i=0;i<=7;i++) {
+          record2[i]=BP.getc(); 
+          pc.printf("measure Command Response: %x \n\r",record2[i]); }
+         
+          
+          
+         
+          
+          
+          
+     }
+        
+       
+    
+
+}
\ No newline at end of file