Test the HalfDuplex library bypassing the MX12 library

Dependencies:   mbed-src

Fork of MX106-custom by Team DIANA

Revision:
3:d44622fe4fac
Parent:
1:946c65496383
--- a/main.cpp	Tue Apr 26 16:51:04 2016 +0000
+++ b/main.cpp	Thu Apr 28 11:14:00 2016 +0000
@@ -1,16 +1,46 @@
 #include "mbed.h"
-#include "AX12.h"
+#include "SerialHalfDuplex.h"
+
+// connettere insieme D2, D8, Rpu_5V=10kohm e MX106_data
+Serial pc(SERIAL_TX, SERIAL_RX);
+SerialHalfDuplex MX106(PA_9, PA_10);
+
 
 int main() {
-   Serial pc(USBTX, USBRX);
-   AX12 MX106(PA_0, PA_1, 1);
-   pc.printf("Start run!");
-   
+  pc.printf("Si comincia \n");
+  /*
+  pc.printf("Scrivo il comando di accensione LED \n");
+  
+  MX106.putc(0xFF);
+  MX106.putc(0xFF);
+  MX106.putc(0x01);
+  MX106.putc(0x04);
+  MX106.putc(0x03);
+  MX106.putc(0x19);
+  MX106.putc(0x01);
+  MX106.putc(0xDD); 
    
-   while (1) {
-                 
-      pc.printf("%f",MX106.GetTemp());
-        
-        
-    }
+   while (1) { 
+    if(MX106.readable()){                
+      pc.printf("ricevuto %c \n", MX106.getc());        
+     }
+    }   
+    */ 
+    
+    pc.printf("Scrivo il comando di lettura temperatura \n");
+  
+  MX106.putc(0xFF);
+  MX106.putc(0xFF);
+  MX106.putc(0x01);
+  MX106.putc(0x04);
+  MX106.putc(0x02);
+  MX106.putc(0x2B);
+  MX106.putc(0x01);
+  MX106.putc(0xCC); 
+   
+   while (1) { 
+    if(MX106.readable()){                
+      pc.printf("ricevuto %c \n", MX106.getc());        
+     }
+    }   
 }
\ No newline at end of file