program 4 code
Dependencies: LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI
Diff: main.cpp
- Revision:
- 0:84dbe22c269c
- Child:
- 1:551c68b9547b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 28 17:37:30 2020 +0000 @@ -0,0 +1,79 @@ +#include "mbed.h" +#include "LCD_DISCO_F429ZI.h" + +LCD_DISCO_F429ZI lcd; +InterruptIn user_button(USER_BUTTON); +DigitalOut led1(LED1); +extern "C" uint32_t getMax(); + + +void button_pressed() +{ + +} + +void button_released() +{ + +} +int main() +{ + user_button.rise(&button_pressed); + user_button.fall(&button_released); + uint8_t text[30]; + led1 = 1; + +// uint32_t count=getMax(); + uint32_t count=4; + uint32_t totalFreq=0; + BSP_LCD_SetFont(&Font20); + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE); + wait(1); + + while(1) + { + lcd.Clear(LCD_COLOR_BLUE); + lcd.SetBackColor(LCD_COLOR_BLUE); + lcd.SetTextColor(LCD_COLOR_WHITE); + wait(0.3); + + uint16_t Xpos =100; + for(int i=0;i<count;i++){ + uint32_t word=0; + uint32_t wordFreq=0; + float freq= wordFreq/totalFreq; + sprintf((char*)text, "i=%d", i); + lcd.DisplayStringAt(i, LINE(i), (uint8_t *)&text, LEFT_MODE); + + uint16_t h=i*20; + lcd.DrawRect(Xpos, 200, 20, h); + Xpos=Xpos+30; + } + wait(1); + + lcd.Clear(LCD_COLOR_GREEN); + + lcd.SetTextColor(LCD_COLOR_BLUE); + lcd.FillRect(10, 20, 50, 50); + wait(0.1); + lcd.SetTextColor(LCD_COLOR_BROWN); + lcd.FillCircle(80, 80, 50); + wait(0.1); + lcd.SetTextColor(LCD_COLOR_YELLOW); + lcd.FillEllipse(150, 150, 50, 100); + wait(0.1); + lcd.SetTextColor(LCD_COLOR_RED); + lcd.FillCircle(200, 200, 40); + wait(1); + + lcd.SetBackColor(LCD_COLOR_ORANGE); + lcd.SetTextColor(LCD_COLOR_CYAN); + BSP_LCD_SetFont(&Font24); + lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"HAVE FUN !!!", CENTER_MODE); + wait(1); + + led1 = !led1; + wait(0.5); + } +} +