DISCO-F746NG_LCD_demo

Dependencies:   mbed LCD_DISCO_F746NG BSP_DISCO_F746NG

Files at this revision

API Documentation at this revision

Comitter:
alixhavr10
Date:
Tue Dec 07 13:22:05 2021 +0000
Parent:
0:f5f54c7509b4
Commit message:
THE_ECG

Changed in this revision

BSP_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/BSP_DISCO_F746NG.lib	Mon Feb 22 17:22:42 2016 +0000
+++ b/BSP_DISCO_F746NG.lib	Tue Dec 07 13:22:05 2021 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#ee089790cdbb
+https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
--- a/main.cpp	Mon Feb 22 17:22:42 2016 +0000
+++ b/main.cpp	Tue Dec 07 13:22:05 2021 +0000
@@ -1,117 +1,64 @@
 #include "mbed.h"
 #include "LCD_DISCO_F746NG.h"
-
-LCD_DISCO_F746NG lcd;
-DigitalOut LCD_D5(D5); 
+#include <stdio.h>
 
 
-AnalogIn input0(A0);
-AnalogIn input1(A1);
-AnalogIn input2(A2);
-AnalogIn input3(A3);
-AnalogIn input4(A4);
-AnalogIn input5(A5);
-
-// drawHomeScreen - Custom Function
-void drawHomeScreen() {
-    lcd.Clear(LCD_COLOR_GREEN);
-
-    lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE);
-    lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"HOME SCREEN", RIGHT_MODE);
-}
-
-// drawAnalogScreen - Custom Function
-void drawAnalogScreen() {
-    lcd.Clear(LCD_COLOR_BLUE);
-    
-    lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"A0", LEFT_MODE);
-    lcd.DisplayStringAt(0, LINE(2), (uint8_t *)"A1", LEFT_MODE);
-    lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"A2", LEFT_MODE);
-    lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"A3", LEFT_MODE);
-    lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"A4", LEFT_MODE);
-    lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"A5", LEFT_MODE);
-
-    lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"ANALOG SCREEN", RIGHT_MODE);
-}
-
-
+LCD_DISCO_F746NG lcd;
+DigitalOut led1(LED1);
+AnalogIn mesure_analogique(PA_0);
+PwmOut Buzzer(PA_8);
+DigitalIn mon_bouton(PI_11);
 
 int main()
 {  
-    char currentPage, selectedUnit;
-    drawHomeScreen();
-    wait(2);  
-    drawAnalogScreen();
+    float val,time;
+    int X, Y,X_max,Y_max,Range;
+    int a = mon_bouton.read();
+    char chaine[50];
+// initialisations
+    val=0;
+    led1 = 1;
+    time=0.2f;
+    lcd.Clear(LCD_COLOR_BLACK);
+    lcd.SetBackColor(LCD_COLOR_BLACK);
+    lcd.SetTextColor(LCD_COLOR_WHITE);
+    X_max=lcd.GetXSize();
+    Y_max=lcd.GetYSize();
+    X=0;
+    Range=200;
+    Y=Y_max-10;
     
-    while(1)
-    {
-      
-       LCD_D5 = 1;
-      
-      lcd.SetBackColor(LCD_COLOR_RED);
-      lcd.SetTextColor(LCD_COLOR_WHITE);
-      //lcd.Clear(LCD_COLOR_BLUE);
-
-        double meas0 = (5*input0.read_u16())/(double)65535; 
-        char strarray0[50];           
-        sprintf(strarray0, "  %f  ", meas0);
-        
-        uint16_t meas1 = input1.read_u16(); 
-        char strarray1[50];           
-        sprintf(strarray1, "  %d  ", meas1);
-        
-        uint16_t meas2 = input2.read_u16(); 
-        char strarray2[50];           
-        sprintf(strarray2, "  %d  ", meas2);
-        
-        uint16_t meas3 = input3.read_u16(); 
-        char strarray3[50];           
-        sprintf(strarray3, "  %d  ", meas3);
-        
-        uint16_t meas4 = input4.read_u16(); 
-        char strarray4[50];           
-        sprintf(strarray4, "  %d  ", meas4);
-        
-        uint16_t meas5 = input5.read_u16(); 
-        char strarray5[50];           
-        sprintf(strarray5, "  %d  ", meas5);
-        
-
-
-        lcd.DisplayStringAt(0, LINE(1), (uint8_t *)strarray0, RIGHT_MODE);
-        lcd.DisplayStringAt(0, LINE(2), (uint8_t *)strarray1, CENTER_MODE);
-        lcd.DisplayStringAt(0, LINE(3), (uint8_t *)strarray2, CENTER_MODE);
-        lcd.DisplayStringAt(0, LINE(4), (uint8_t *)strarray3, CENTER_MODE);
-        lcd.DisplayStringAt(0, LINE(5), (uint8_t *)strarray4, CENTER_MODE);
-        lcd.DisplayStringAt(0, LINE(6), (uint8_t *)strarray5, CENTER_MODE);
-
-        
-        //lcd.Clear(LCD_COLOR_BLUE);
-        //lcd.SetTextColor(LCD_COLOR_BROWN);
-        //lcd.DrawCircle(200, 200, meas0/10);
-          
-        wait(0.160f);
-     }
-     
-      lcd.Clear(LCD_COLOR_GREEN);      
-      lcd.SetTextColor(LCD_COLOR_BLUE);
-      lcd.DrawRect(10, 20, 50, 50);
-      wait(0.1);
-      lcd.SetTextColor(LCD_COLOR_BROWN);
-      lcd.DrawCircle(80, 80, 50);
-      wait(0.1);
-      lcd.SetTextColor(LCD_COLOR_YELLOW);
-      lcd.DrawEllipse(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);
-      lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"HAVE FUN !!!", CENTER_MODE);
-      wait(1);
-
-     // pin5 = !pin5;
-    
+    if(a == 0){ //bouton poussoir non enfoncé
+        while(1)
+        {
+            val=mesure_analogique.read();
+            val=val*3.3;
+            sprintf((char*)chaine,"tension (en V) = %3.3f",val);
+            lcd.DisplayStringAt(0, LINE(1), (uint8_t *)&chaine, CENTER_MODE);
+            Y=Y_max-Range*val/3.3;
+            lcd.DrawPixel(X,Y,LCD_COLOR_WHITE);
+            wait_ms(3);//3 ms est la meilleure des valeurs
+            X=X+1;
+            if(X > X_max) { 
+                X = 0;
+                lcd.Clear(LCD_COLOR_BLACK);
+                sprintf((char*)chaine,"tension (en V) = %3.3f",val); 
+                }
+            if(val<=1.9){ 
+                Buzzer.write(0);
+            }
+            if(val>=3){
+                Buzzer.write(0);
+           }
+           if(val<=0.1){
+                Buzzer.pulsewidth(160.0f);
+                }
+            else{
+                Buzzer.period_ms(10.0f); //pour le son 
+                //Buzzer.write(0.1f);
+                Buzzer.pulsewidth_ms(5.0f);
+                }
+           }
+        }
+        else{//bouton poussoir enfoncé obj :figer l'écran
 }
--- a/mbed.bld	Mon Feb 22 17:22:42 2016 +0000
+++ b/mbed.bld	Tue Dec 07 13:22:05 2021 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/f141b2784e32
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file