![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
stan projektu 20 maja
Dependencies: mbed LCD_DISCO_F469NI TS_DISCO_F469NI F469_GUI BSP_DISCO_F469NI
main.cpp@1:5a6352364c9c, 2019-05-20 (annotated)
- Committer:
- Fenris
- Date:
- Mon May 20 10:00:25 2019 +0000
- Revision:
- 1:5a6352364c9c
- Parent:
- 0:0da7047bbb6e
v1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Adasqo | 0:0da7047bbb6e | 1 | #include "mbed.h" |
Adasqo | 0:0da7047bbb6e | 2 | #include "LCD_DISCO_F469NI.h" |
Adasqo | 0:0da7047bbb6e | 3 | #include <string> |
Adasqo | 0:0da7047bbb6e | 4 | #include <sstream> |
Adasqo | 0:0da7047bbb6e | 5 | #include <stdio.h> |
Fenris | 1:5a6352364c9c | 6 | #include "F469_GUI.hpp" |
Fenris | 1:5a6352364c9c | 7 | #include "stm32469i_discovery.h" |
Fenris | 1:5a6352364c9c | 8 | #include "TS_DISCO_F469NI.h" |
Adasqo | 0:0da7047bbb6e | 9 | |
Adasqo | 0:0da7047bbb6e | 10 | LCD_DISCO_F469NI lcd; |
Adasqo | 0:0da7047bbb6e | 11 | |
Adasqo | 0:0da7047bbb6e | 12 | DigitalOut led1(LED1); |
Adasqo | 0:0da7047bbb6e | 13 | AnalogIn analog_value(A0); |
Adasqo | 0:0da7047bbb6e | 14 | |
Adasqo | 0:0da7047bbb6e | 15 | |
Adasqo | 0:0da7047bbb6e | 16 | int main() |
Adasqo | 0:0da7047bbb6e | 17 | { |
Fenris | 1:5a6352364c9c | 18 | Button button1(20, 60, 200, 70, "Pomiar jednorazowy"); |
Fenris | 1:5a6352364c9c | 19 | Button button2(20, 150, 200, 70, "Pomiar okresowy"); |
Fenris | 1:5a6352364c9c | 20 | Button button3(20, 240, 200, 70, "Pomiar testowy"); |
Adasqo | 0:0da7047bbb6e | 21 | lcd.SetBackColor(LCD_COLOR_BLUE); |
Adasqo | 0:0da7047bbb6e | 22 | lcd.SetTextColor(LCD_COLOR_WHITE); |
Adasqo | 0:0da7047bbb6e | 23 | uint8_t text[30]; |
Adasqo | 0:0da7047bbb6e | 24 | float meas; |
Adasqo | 0:0da7047bbb6e | 25 | //lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE); |
Adasqo | 0:0da7047bbb6e | 26 | wait(1); |
Adasqo | 0:0da7047bbb6e | 27 | |
Adasqo | 0:0da7047bbb6e | 28 | while(1) |
Adasqo | 0:0da7047bbb6e | 29 | { |
Fenris | 1:5a6352364c9c | 30 | if (button1.Touched()){ |
Fenris | 1:5a6352364c9c | 31 | button2.Draw(); |
Fenris | 1:5a6352364c9c | 32 | |
Fenris | 1:5a6352364c9c | 33 | meas = analog_value.read(); |
Fenris | 1:5a6352364c9c | 34 | meas = meas * 3300; |
Adasqo | 0:0da7047bbb6e | 35 | |
Fenris | 1:5a6352364c9c | 36 | led1 = 0; |
Fenris | 1:5a6352364c9c | 37 | lcd.DisplayStringAt(0, LINE(12), (uint8_t *)"Nie ma wody", CENTER_MODE); |
Adasqo | 0:0da7047bbb6e | 38 | |
Fenris | 1:5a6352364c9c | 39 | if(meas<2000){ |
Fenris | 1:5a6352364c9c | 40 | led1 = 1; |
Fenris | 1:5a6352364c9c | 41 | lcd.DisplayStringAt(0, LINE(12), (uint8_t *)"Jest woda", CENTER_MODE); |
Adasqo | 0:0da7047bbb6e | 42 | |
Fenris | 1:5a6352364c9c | 43 | } |
Fenris | 1:5a6352364c9c | 44 | sprintf((char*)text, "Pomiar: %f", meas); |
Fenris | 1:5a6352364c9c | 45 | lcd.DisplayStringAt(0, LINE(8), (uint8_t *)&text, CENTER_MODE); |
Fenris | 1:5a6352364c9c | 46 | |
Fenris | 1:5a6352364c9c | 47 | } |
Fenris | 1:5a6352364c9c | 48 | if (button2.Touched()) button1.Draw(); |
Fenris | 1:5a6352364c9c | 49 | |
Fenris | 1:5a6352364c9c | 50 | |
Adasqo | 0:0da7047bbb6e | 51 | //string a = tostr(meas); |
Adasqo | 0:0da7047bbb6e | 52 | //char buffer [10]; |
Adasqo | 0:0da7047bbb6e | 53 | //sprintf (buffer, "%6.2f",meas);// datastream value |
Adasqo | 0:0da7047bbb6e | 54 | //string data = buffer; |
Adasqo | 0:0da7047bbb6e | 55 | //lcd.Clear(LCD_COLOR_BLUE); |
Adasqo | 0:0da7047bbb6e | 56 | |
Adasqo | 0:0da7047bbb6e | 57 | //lcd.DisplayStringAt(0, LINE(10),(uint8_t *)"%6.2f",meas , CENTER_MODE); |
Adasqo | 0:0da7047bbb6e | 58 | |
Adasqo | 0:0da7047bbb6e | 59 | //sprintf((char*)text, "Touches: 0"); |
Adasqo | 0:0da7047bbb6e | 60 | //lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); |
Adasqo | 0:0da7047bbb6e | 61 | //lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"BARDZO ELEGANCKI PROJEKT", CENTER_MODE); |
Adasqo | 0:0da7047bbb6e | 62 | wait(1); |
Adasqo | 0:0da7047bbb6e | 63 | |
Adasqo | 0:0da7047bbb6e | 64 | } |
Adasqo | 0:0da7047bbb6e | 65 | } |
Adasqo | 0:0da7047bbb6e | 66 |