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桁に変更しました。
meter.h@3:bf8761c8eb17, 2017-07-21 (annotated)
- Committer:
- Rhyme
- Date:
- Fri Jul 21 02:01:05 2017 +0000
- Revision:
- 3:bf8761c8eb17
- Parent:
- 0:d01def9cf41e
Some source code clean-ups done; The first document added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:d01def9cf41e | 1 | #ifndef _METER_H_ |
Rhyme | 0:d01def9cf41e | 2 | #define _METER_H_ |
Rhyme | 3:bf8761c8eb17 | 3 | /** |
Rhyme | 3:bf8761c8eb17 | 4 | * meter class |
Rhyme | 3:bf8761c8eb17 | 5 | * A simple analog style meter |
Rhyme | 3:bf8761c8eb17 | 6 | **/ |
Rhyme | 0:d01def9cf41e | 7 | |
Rhyme | 0:d01def9cf41e | 8 | class meter { |
Rhyme | 0:d01def9cf41e | 9 | public: |
Rhyme | 3:bf8761c8eb17 | 10 | /** |
Rhyme | 3:bf8761c8eb17 | 11 | * meter constructor |
Rhyme | 3:bf8761c8eb17 | 12 | * @param x right-top position of meter |
Rhyme | 3:bf8761c8eb17 | 13 | * @param y right-top position of meter |
Rhyme | 3:bf8761c8eb17 | 14 | * @param width width of meter |
Rhyme | 3:bf8761c8eb17 | 15 | * @param height height of meter |
Rhyme | 3:bf8761c8eb17 | 16 | * @param min minimum value of meter |
Rhyme | 3:bf8761c8eb17 | 17 | * @param max maximum value of meter |
Rhyme | 3:bf8761c8eb17 | 18 | */ |
Rhyme | 0:d01def9cf41e | 19 | meter(int x, int y, int width, int height, float min, float max) ; |
Rhyme | 3:bf8761c8eb17 | 20 | |
Rhyme | 3:bf8761c8eb17 | 21 | /** |
Rhyme | 3:bf8761c8eb17 | 22 | * meter destructor |
Rhyme | 3:bf8761c8eb17 | 23 | */ |
Rhyme | 0:d01def9cf41e | 24 | ~meter(void) ; |
Rhyme | 3:bf8761c8eb17 | 25 | |
Rhyme | 3:bf8761c8eb17 | 26 | /** |
Rhyme | 3:bf8761c8eb17 | 27 | * drawFrame draw meter frame/canvas |
Rhyme | 3:bf8761c8eb17 | 28 | */ |
Rhyme | 0:d01def9cf41e | 29 | void drawFrame(void) ; |
Rhyme | 3:bf8761c8eb17 | 30 | |
Rhyme | 3:bf8761c8eb17 | 31 | /** |
Rhyme | 3:bf8761c8eb17 | 32 | * drawScale draw measuring mark |
Rhyme | 3:bf8761c8eb17 | 33 | */ |
Rhyme | 0:d01def9cf41e | 34 | void drawScale(void) ; |
Rhyme | 3:bf8761c8eb17 | 35 | |
Rhyme | 3:bf8761c8eb17 | 36 | /** |
Rhyme | 3:bf8761c8eb17 | 37 | * drawHand draw meter hand at value position |
Rhyme | 3:bf8761c8eb17 | 38 | * @param value value to plot the hand |
Rhyme | 3:bf8761c8eb17 | 39 | */ |
Rhyme | 0:d01def9cf41e | 40 | void drawHand(float value) ; |
Rhyme | 3:bf8761c8eb17 | 41 | |
Rhyme | 3:bf8761c8eb17 | 42 | /** |
Rhyme | 3:bf8761c8eb17 | 43 | * drawValue draw textual value in the lower part of the meter |
Rhyme | 3:bf8761c8eb17 | 44 | * @param value value to display (voltage assumed) |
Rhyme | 3:bf8761c8eb17 | 45 | */ |
Rhyme | 0:d01def9cf41e | 46 | void drawValue(float value) ; |
Rhyme | 3:bf8761c8eb17 | 47 | |
Rhyme | 3:bf8761c8eb17 | 48 | /** |
Rhyme | 3:bf8761c8eb17 | 49 | * draw draw full set of the meter |
Rhyme | 3:bf8761c8eb17 | 50 | * @param value value to display and put hand |
Rhyme | 3:bf8761c8eb17 | 51 | */ |
Rhyme | 0:d01def9cf41e | 52 | void draw(float value) ; |
Rhyme | 3:bf8761c8eb17 | 53 | |
Rhyme | 3:bf8761c8eb17 | 54 | /** |
Rhyme | 3:bf8761c8eb17 | 55 | * update draw only hand and value text |
Rhyme | 3:bf8761c8eb17 | 56 | */ |
Rhyme | 0:d01def9cf41e | 57 | void update(float value) ; |
Rhyme | 0:d01def9cf41e | 58 | |
Rhyme | 0:d01def9cf41e | 59 | private: |
Rhyme | 0:d01def9cf41e | 60 | int _x ; |
Rhyme | 0:d01def9cf41e | 61 | int _y ; |
Rhyme | 0:d01def9cf41e | 62 | int _w ; |
Rhyme | 0:d01def9cf41e | 63 | int _h ; |
Rhyme | 0:d01def9cf41e | 64 | int _center_x ; |
Rhyme | 0:d01def9cf41e | 65 | int _center_y ; |
Rhyme | 0:d01def9cf41e | 66 | float _min ; |
Rhyme | 0:d01def9cf41e | 67 | float _max ; |
Rhyme | 0:d01def9cf41e | 68 | |
Rhyme | 0:d01def9cf41e | 69 | } ; |
Rhyme | 0:d01def9cf41e | 70 | |
Rhyme | 0:d01def9cf41e | 71 | #endif /* _METER_H_ */ |