![](/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
Diff: main.cpp
- Revision:
- 0:0da7047bbb6e
- Child:
- 1:5a6352364c9c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 20 09:16:38 2019 +0000 @@ -0,0 +1,54 @@ +#include "mbed.h" +#include "LCD_DISCO_F469NI.h" +#include <string> +#include <sstream> +#include <stdio.h> + +LCD_DISCO_F469NI lcd; + +DigitalOut led1(LED1); +AnalogIn analog_value(A0); + + +int main() +{ + 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) + { + + meas = analog_value.read(); + meas = meas * 3300; + + led1 = 0; + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Nie ma wody", CENTER_MODE); + + if(meas<2000){ + lcd.Clear(LCD_COLOR_BLUE); + led1 = 1; + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Jest woda", CENTER_MODE); + + } + //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, "Pomiar: %f", meas); + lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_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); + + } +} +