lyre liu / Mbed 2 deprecated project1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lyreliu
Date:
Sun Mar 06 13:36:17 2016 +0000
Parent:
2:65d319447726
Child:
4:8af87a432c12
Commit message:
lpc1786 program

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Mar 06 12:05:15 2016 +0000
+++ b/main.cpp	Sun Mar 06 13:36:17 2016 +0000
@@ -12,7 +12,8 @@
 DigitalOut low_pin(p6);             //test pin, p6 is the low level pin
                                     
 float mass;                         // The mass of the object
-unsigned short int mass_trans;       // A 8 bits mass used for transmitting
+unsigned short int mass_trans_high; // A 8 bits mass used for transmitting
+unsigned short int mass_trans_low;
 
 int main()
 {
@@ -47,8 +48,15 @@
 
 void SerialTransmit(void)
 {   
+    unsigned int start,end;
+    start = 0xfe;
+    end   = 0xff;
     if(mass>3)
         mass =3;
-    mass_trans = mass*85;
-    pc.printf("%d",mass_trans);
+    mass_trans_low = (int)(mass*10000);
+    mass_trans_high = (int)(mass*10000)>>8;
+    pc.printf("%d",start);
+    pc.printf("%d",mass_trans_high);
+    pc.printf("%d",mass_trans_low);
+    pc.printf("%d",end);
 }
\ No newline at end of file