A simple meter using Adafruit 2.8 TFT with touch v2

Dependencies:   SPI_STMPE610 UniGraphic mbed vt100

/media/uploads/Rhyme/tester_s.jpg

A dumb simple voltage tester using ADC.
With FRDM-KL25Z, you can measure about 0V to 3.28V.
Nothing to drop your jaw nor holding your breath
but I wanted one, so I wrote one ;-)

とても単純はADCを使用した電圧テスターです。
FRDM-KL25Z を使用した場合、0V ~ 3.28V くらいが測定範囲です。
特に目新しいことも、驚くこともありませんが、
自分が欲しいので書いてみました (^ - ^)

On 18-May-2018 
I changed the number display from 0.00 to 0.000
so that I can measure the change of a small loadcell.

2018年5月18日 
ロードセル (重量センサ)の出力値の変化を見たかったので
有効数字を小数点以下2桁から3桁に変更しました。

Files at this revision

API Documentation at this revision

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) ;