stan projektu 20 maja
Dependencies: mbed LCD_DISCO_F469NI TS_DISCO_F469NI F469_GUI BSP_DISCO_F469NI
main.cpp
- Committer:
- Fenris
- Date:
- 2019-05-20
- Revision:
- 1:5a6352364c9c
- Parent:
- 0:0da7047bbb6e
File content as of revision 1:5a6352364c9c:
#include "mbed.h" #include "LCD_DISCO_F469NI.h" #include <string> #include <sstream> #include <stdio.h> #include "F469_GUI.hpp" #include "stm32469i_discovery.h" #include "TS_DISCO_F469NI.h" LCD_DISCO_F469NI lcd; DigitalOut led1(LED1); AnalogIn analog_value(A0); int main() { Button button1(20, 60, 200, 70, "Pomiar jednorazowy"); Button button2(20, 150, 200, 70, "Pomiar okresowy"); Button button3(20, 240, 200, 70, "Pomiar testowy"); lcd.SetBackColor(LCD_COLOR_BLUE); lcd.SetTextColor(LCD_COLOR_WHITE); uint8_t text[30]; float meas; //lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE); wait(1); while(1) { if (button1.Touched()){ button2.Draw(); meas = analog_value.read(); meas = meas * 3300; led1 = 0; lcd.DisplayStringAt(0, LINE(12), (uint8_t *)"Nie ma wody", CENTER_MODE); if(meas<2000){ led1 = 1; lcd.DisplayStringAt(0, LINE(12), (uint8_t *)"Jest woda", CENTER_MODE); } sprintf((char*)text, "Pomiar: %f", meas); lcd.DisplayStringAt(0, LINE(8), (uint8_t *)&text, CENTER_MODE); } if (button2.Touched()) button1.Draw(); //string a = tostr(meas); //char buffer [10]; //sprintf (buffer, "%6.2f",meas);// datastream value //string data = buffer; //lcd.Clear(LCD_COLOR_BLUE); //lcd.DisplayStringAt(0, LINE(10),(uint8_t *)"%6.2f",meas , CENTER_MODE); //sprintf((char*)text, "Touches: 0"); //lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); //lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"BARDZO ELEGANCKI PROJEKT", CENTER_MODE); wait(1); } }