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 Jul 21 01:24:53 2017 +0000
Parent:
1:d7f2aa328962
Child:
3:bf8761c8eb17
Commit message:
organizing index count for theta (on going)

Changed in this revision

meter.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/meter.cpp	Thu Jul 20 04:59:51 2017 +0000
+++ b/meter.cpp	Fri Jul 21 01:24:53 2017 +0000
@@ -97,19 +97,18 @@
     if (theta < 0.0) { theta = 0.0 ; }
     if (theta > 90.0) { theta = 90.0 ; }
     if (theta > 45.0) {
-        i = (10.0 * (90.0 - theta + 45.0) + 0.5) ; 
-        x1 = _center_x -(radius * COS[i-450] + 0.5) ;
-        x2 = _center_x -((radius + append) * COS[i-450] + 0.5) ;
+        i = (10.0 * (90.0 - theta + 45.0) + 0.5) - 450  ; 
+        x1 = _center_x -(radius * COS[i] + 0.5) ;
+        x2 = _center_x -((radius + append) * COS[i] + 0.5) ;
     } else {
-        i = (10.0 * (theta + 45.0) + 0.5) ;
-        x1 = _center_x + (radius * COS[i-450] + 0.5) ;
-        x2 = _center_x + ((radius + append) * COS[i-450] + 0.5) ;
+        i = (10.0 * (theta + 45.0) + 0.5) - 450 ;
+        x1 = _center_x + (radius * COS[i] + 0.5) ;
+        x2 = _center_x + ((radius + append) * COS[i] + 0.5) ;
     }
 
-    y1 = _center_y - (radius * SIN[i-450] + 0.5) ;
-    y2 = _center_y - ((radius + append) * SIN[i-450] + 0.5) ;
+    y1 = _center_y - (radius * SIN[i] + 0.5) ;
+    y2 = _center_y - ((radius + append) * SIN[i] + 0.5) ;
     tft->BusEnable(true) ;
-    printf("i = %d (%d, %d) - (%d, %d)\n", i, x1, y1, x2, y2) ;
     tft->line(prev_x1, prev_y1, prev_x2, prev_y2, White) ;
     tft->line(x1, y1, x2, y2, Black) ;
     tft->BusEnable(false) ;