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.
Revision 10:0457bb95d21e, committed 2016-03-08
- Comitter:
- lyreliu
- Date:
- Tue Mar 08 10:01:44 2016 +0000
- Parent:
- 9:f4bfd06b3ef1
- Child:
- 11:261f1ba05668
- Commit message:
- program %c
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Mar 08 08:13:18 2016 +0000 +++ b/main.cpp Tue Mar 08 10:01:44 2016 +0000 @@ -1,6 +1,6 @@ #include "mbed.h" #define RATIO 1 //The amplified factor of the OA ?????????????????????????????????????????????????? -#define SAMPLE_TIME 100 // Sample time, default is 100ms +#define SAMPLE_TIME 500 // Sample time, default is 100ms void MassCompute(float); // The function of computing mass from voltage. void SerialInit(void); // The function fo serial initial void SerialTransmit(void); // Transmit the data through the serial @@ -57,17 +57,17 @@ unsigned char start,end,test1,test2; start = 0xfe; end = 0xff; - test1 = '%'; - test2 = '$'; + //test1 = '%'; + //test2 = '$'; if(mass>3) mass =3; - //mass_trans_low = (unsigned char)(mass*10000); - //mass_trans_high = (unsigned char)(mass*10000)>>8; + mass_trans_low = (unsigned char)(mass*10000); + mass_trans_high = (unsigned char)(mass*10000)>>8; - pc.printf("%u",start); - //pc.printf("%u",mass_trans_high); - //pc.printf("%u",mass_trans_low); - pc.printf("%u",test1); - pc.printf("%u",test2); - pc.printf("%u",end); + pc.printf("%c",start); + pc.printf("%c",mass_trans_high); + pc.printf("%c",mass_trans_low); + //pc.printf("%c",test1); + //pc.printf("%c",test2); + pc.printf("%c",end); } \ No newline at end of file