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.
Dependencies: SPI_STMPE610 UniGraphic mbed vt100
Revision 4:0607a2a46238, committed 2018-05-18
- Comitter:
- Rhyme
- Date:
- Fri May 18 01:25:32 2018 +0000
- Parent:
- 3:bf8761c8eb17
- Commit message:
- Changed the display value from 0.00 to 0.000
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
meter.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r bf8761c8eb17 -r 0607a2a46238 main.cpp --- a/main.cpp Fri Jul 21 02:01:05 2017 +0000 +++ b/main.cpp Fri May 18 01:25:32 2018 +0000 @@ -53,8 +53,8 @@ double value = 0.0 ; int intvalue = 0 ; value = ADC_MAX_VALUE * vin->read() ; - intvalue = (int)(100.0 * value + 0.5) ; - value = (double)intvalue / 100.0 ; + intvalue = (int)(1000.0 * value + 0.5) ; + value = (double)intvalue / 1000.0 ; return( value ) ; } @@ -67,6 +67,7 @@ while(1) { value = getRoundedValue() ; + printf("%.2f\n", value) ; if (value != prev_value) { tacho->update(value) ; prev_value = value ;
diff -r bf8761c8eb17 -r 0607a2a46238 meter.cpp --- a/meter.cpp Fri Jul 21 02:01:05 2017 +0000 +++ b/meter.cpp Fri May 18 01:25:32 2018 +0000 @@ -125,8 +125,8 @@ char str[32] ; int v1, v2 ; v1 = (int)value ; - v2 = ((int)(100.0 * value) % 100) ; - sprintf(str, "%d.%02d V", v1, v2) ; + v2 = ((int)(1000.0 * value) % 1000) ; + sprintf(str, "%d.%03d V", v1, v2) ; tft->BusEnable(true) ; tft->locate(80, 190) ; tft->printf(str) ;