TP_capteur_courant_v2

Dependencies:   BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG mbed

Fork of TP_Interfacage_Capteur_Courant by Moussa Oudjama

Files at this revision

API Documentation at this revision

Comitter:
MoussOudj
Date:
Thu Jun 21 10:25:32 2018 +0000
Parent:
1:724f5e3b485a
Commit message:
TP_capteur_courant_V2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 21 09:26:09 2018 +0000
+++ b/main.cpp	Thu Jun 21 10:25:32 2018 +0000
@@ -3,10 +3,12 @@
 #include "LCD_DISCO_F746NG.h"
 #include "Smiley.h"
 
+
 LCD_DISCO_F746NG lcd;
 TS_DISCO_F746NG ts;
 AnalogIn anal(A4);
 TS_StateTypeDef TS_State;
+//LocalFileSystem local("local");
 
 ///////////////////////////////////Déclaration des variables///////////////////////////////////////////
 float tension = 0;
@@ -43,7 +45,7 @@
    
    Init_Bouton();       //Appel de la fonction d'initialisation des boutons
     
-   //lcd.DrawBitmap(20,20,(uint8_t *)test);
+   //lcd.DrawBitmap(20,20,(uint8_t*)"local\stop.bmp");
     
     
     while(1) {
@@ -107,11 +109,16 @@
 ///////////////////////////////////////Initialisation Bouton///////////////////////////////////////
 void Init_Bouton(void)
 {
-
+    
+    
 
-    lcd.Clear(LCD_COLOR_BLUE); //Effacer l'affichage actuel
+    lcd.Clear(LCD_COLOR_WHITE); //Effacer l'affichage actuel
     lcd.SetFont(&Font16);
-    lcd.SetBackColor(LCD_COLOR_BLUE);   //Background en bleu
+    lcd.SetBackColor(LCD_COLOR_WHITE);   //Background en bleu
+    
+    
+    
+        
     
     lcd.SetTextColor(LCD_COLOR_RED);    //Dessine le premier bouton en rouge
     lcd.DrawCircle(350, 230, 30);       //Dessine le bouton (x,y,rayon)
@@ -121,7 +128,11 @@
     lcd.DrawCircle(150, 230, 30);
     lcd.FillCircle(150, 230, 30);
     
-    lcd.SetTextColor(LCD_COLOR_WHITE);  //Remettre l'écriture du texte en blanc
+    lcd.SetTextColor(LCD_COLOR_BLUE);  //Remettre l'écriture du texte en blanc
+    
+    lcd.DrawRect(140,100,215,60);
+    sprintf((char*)text, "Capteur de courant");       //Efface l'affichage de l'état Start
+    lcd.DisplayStringAt(155, LINE(3), (uint8_t *)&text, LEFT_MODE); 
 
 
 }
@@ -142,13 +153,42 @@
             
         }
         
+        if(amp<0)
+        {
+         
+           /*sprintf((char*)text, "      ");           //Affichage de l'état Start
+           lcd.DisplayStringAt(220, LINE(13), (uint8_t *)&text, LEFT_MODE);*/
+         
+            
+         
+            sprintf((char*)text, "Calibration");           //Affichage de l'état Start
+            lcd.DisplayStringAt(200, LINE(11), (uint8_t *)&text, LEFT_MODE);
+        }
+        else
+        {
+         
+         
+         sprintf((char*)text, "            ");     //Efface l'affichage de l'état Stop
+         lcd.DisplayStringAt(200, LINE(11), (uint8_t *)&text, LEFT_MODE);
+         
+          /*sprintf((char*)text, "Mesure");           //Affichage de l'état Start
+           lcd.DisplayStringAt(220, LINE(13), (uint8_t *)&text, LEFT_MODE);*/
+         
+         lcd.ClearStringLine(8);
+         lcd.DrawRect(140,100,215,60);
+         sprintf((char*)text, "Intensite : %.2f",amp);
+         lcd.DisplayStringAt(150, LINE(8),(uint8_t *)&text, LEFT_MODE);   
+        }
+        
+        
+        
          lcd.ClearStringLine(7);    //Effacement de la ligne pour actualiser la valeur
+         lcd.DrawRect(140,100,215,60);
          sprintf((char*)text, "Tension   : %.2f",tension);      //Ecriture de la valeur
          lcd.DisplayStringAt(150, LINE(7),(uint8_t *)&text, LEFT_MODE);     //Affichage de la valeur
                   
-         lcd.ClearStringLine(8);
-         sprintf((char*)text, "Intensite : %.2f",amp);
-         lcd.DisplayStringAt(150, LINE(8),(uint8_t *)&text, LEFT_MODE);
+        
+         
 
          wait(0.3);     //Temporisation
 
@@ -165,11 +205,11 @@
     
  if ((TS_State.touchDetected) & (x>320&x<380) & (y>200&y<260)) {    //Quand touche détectée à la position du bouton Stop
            
-           sprintf((char*)text, "     ");       //Efface l'affichage de l'état Start
-           lcd.DisplayStringAt(0, LINE(3), (uint8_t *)&text, LEFT_MODE);    
+           sprintf((char*)text, "      ");       //Efface l'affichage de l'état Start
+           lcd.DisplayStringAt(220, LINE(13), (uint8_t *)&text, LEFT_MODE);    
            
-           sprintf((char*)text, "Stop");        //Affichage de l'état Stop
-           lcd.DisplayStringAt(0, LINE(2), (uint8_t *)&text, LEFT_MODE);
+           sprintf((char*)text, "Arret");        //Affichage de l'état Stop
+           lcd.DisplayStringAt(220, LINE(13), (uint8_t *)&text, LEFT_MODE);
            
            lcd.ClearStringLine(8);              //Mise à 0  du courant quand la lecture est stoppée
            sprintf((char*)text, "Intensite : %.2f",amp);                    
@@ -185,20 +225,29 @@
            active=0;    //mise à 0 du drapeau
 
            
-           lcd.SetTextColor(LCD_COLOR_WHITE);
+           lcd.SetTextColor(LCD_COLOR_BLUE);
         }
            
         else if((TS_State.touchDetected) & (x>130&x<180) & (y>200&y<260) ) {    //Quand touche détectée à la position du bouton Start
          
-           sprintf((char*)text, "           ");     //Efface l'affichage de l'état Stop
-           lcd.DisplayStringAt(0, LINE(2), (uint8_t *)&text, LEFT_MODE);
+           sprintf((char*)text, "     ");     //Efface l'affichage de l'état Stop
+           lcd.DisplayStringAt(220, LINE(13), (uint8_t *)&text, LEFT_MODE);
+           
+          
+           
+            //active=1;    //mise à 1 du drapeau
+            
+        
+           
          
-           sprintf((char*)text, "Start");           //Affichage de l'état Start
-           lcd.DisplayStringAt(0, LINE(3), (uint8_t *)&text, LEFT_MODE);
+           sprintf((char*)text, "Mesure");           //Affichage de l'état Start
+           lcd.DisplayStringAt(220, LINE(13), (uint8_t *)&text, LEFT_MODE);
            
-           active=1;    //mise à 1 du drapeau
+          active=1;    //mise à 1 du drapeau
+           
+           
 
-           lcd.SetTextColor(LCD_COLOR_WHITE);
+           lcd.SetTextColor(LCD_COLOR_BLUE);
          }