Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:2566acb12c47
- Parent:
- 2:65d319447726
- Child:
- 4:8af87a432c12
--- 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