A simple meter using Adafruit 2.8 TFT with touch v2
Dependencies: SPI_STMPE610 UniGraphic mbed vt100
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桁に変更しました。
Diff: meter.h
- Revision:
- 3:bf8761c8eb17
- Parent:
- 0:d01def9cf41e
diff -r 204e60dbd73d -r bf8761c8eb17 meter.h
--- a/meter.h Fri Jul 21 01:24:53 2017 +0000
+++ b/meter.h Fri Jul 21 02:01:05 2017 +0000
@@ -1,16 +1,59 @@
#ifndef _METER_H_
#define _METER_H_
+/**
+ * meter class
+ * A simple analog style meter
+ **/
class meter {
public:
+/**
+ * meter constructor
+ * @param x right-top position of meter
+ * @param y right-top position of meter
+ * @param width width of meter
+ * @param height height of meter
+ * @param min minimum value of meter
+ * @param max maximum value of meter
+ */
meter(int x, int y, int width, int height, float min, float max) ;
+
+/**
+ * meter destructor
+ */
~meter(void) ;
+
+/**
+ * drawFrame draw meter frame/canvas
+ */
void drawFrame(void) ;
+
+/**
+ * drawScale draw measuring mark
+ */
void drawScale(void) ;
+
+/**
+ * drawHand draw meter hand at value position
+ * @param value value to plot the hand
+ */
void drawHand(float value) ;
+
+/**
+ * drawValue draw textual value in the lower part of the meter
+ * @param value value to display (voltage assumed)
+ */
void drawValue(float value) ;
-void draw(void) ;
+
+/**
+ * draw draw full set of the meter
+ * @param value value to display and put hand
+ */
void draw(float value) ;
+
+/**
+ * update draw only hand and value text
+ */
void update(float value) ;
private:
@@ -20,7 +63,6 @@
int _h ;
int _center_x ;
int _center_y ;
-float _value ;
float _min ;
float _max ;