rtc

Dependents:   programme_final

Ecran.cpp

Committer:
Asoumy
Date:
2016-10-23
Revision:
2:7ace46b4f4f3
Parent:
1:2babe1d342dc
Child:
3:195aa91ec748

File content as of revision 2:7ace46b4f4f3:


#include "mbed.h"
#include "Ecran.h"
#include "LCD_DISCO_F746NG.h"
#include "TS_DISCO_F746NG.h"
#include "ds1338.h"

LCD_DISCO_F746NG lcd;


///////////////////////////// AFFICHAGE_DES_ECRANS////////////////////////////////////////////
  AnalogIn Vpan(A0);
    AnalogIn Ipan(A1);
    AnalogIn Tpan(A2);
    AnalogIn Irr(A3);
    AnalogIn Vbat(A4);
    AnalogIn Ibat(A5);
 
 void horloge();
char jour[6];   
char mois[6];
char annee[6]; 
char heure[6];   
char minute[6];
char seconde[6]; 
char date [60];
char Vpan1 [3];
unsigned int day =00;
unsigned int month =00;
unsigned int year=2000;
unsigned int hour =00;
unsigned int min =00;
unsigned int sec=00;


//////////////////premier ecran///////////////////////
void principal()
{  
    LCD_DISCO_F746NG lcd;
    lcd.Clear(LCD_COLOR_BLACK);
    lcd.SetBackColor(LCD_COLOR_BLACK);
    lcd.SetTextColor(LCD_COLOR_WHITE);
    lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"WELCOME TO LAOS PROJET", CENTER_MODE);  
    }
 ///////FONTCTION QUI AFFICHE LE MODE UTILISATEUR ET LE MODE ADMINISTRATEUR///
 void Ecranprincipal()
 {
   lcd.Clear(LCD_COLOR_WHITE);
   lcd.SetBackColor(LCD_COLOR_WHITE);
   lcd.SetTextColor(LCD_COLOR_WHITE);
   lcd.FillRect(0,0,239,272);
   lcd.SetTextColor(LCD_COLOR_BLACK);
   lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"ADMINISTRATOR", LEFT_MODE);
    
    
    lcd.SetBackColor(LCD_COLOR_BLACK);
    lcd.SetTextColor(LCD_COLOR_BLACK);
    lcd.FillRect(240,0,240,272);
    lcd.SetTextColor(LCD_COLOR_WHITE);
    lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"USER ACCOUNT", RIGHT_MODE); 
    }    
 

 ////FONTCTION QUI AFFICHE LE MENU PRINCIPAL///////
   
        void EcranAdminis()
        {
          lcd.Clear(LCD_COLOR_WHITE);
  
          
 //AFFICHAGE DU BOUTON POUR REGLER L'HEURE ET LA DATE         
           
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.DrawRect(10,50,155,130);
          lcd.SetBackColor(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_DARKCYAN);
          lcd.DisplayStringAt(13, LINE(3), (uint8_t *)"Adjust", LEFT_MODE);
          lcd.DisplayStringAt(13, LINE(4), (uint8_t *)"the date", LEFT_MODE);
           lcd.DisplayStringAt(13, LINE(5), (uint8_t *)"and time", LEFT_MODE);
  
  
//AFFICHAGE DU BOUTON POUR REGLER LA FREQUENCE D'ENVOI SUR LA CARTE SD
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.DrawRect(170,50,158,130);  
          lcd.SetBackColor(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.DisplayStringAt(173, LINE(3), (uint8_t *)"Adjust ", LEFT_MODE);
          lcd.DisplayStringAt(173, LINE(4), (uint8_t *)"the ", LEFT_MODE);
          lcd.DisplayStringAt(173, LINE(5), (uint8_t *)"Delivery", LEFT_MODE);
          lcd.DisplayStringAt(173, LINE(6), (uint8_t *)"frequency", LEFT_MODE);
      
//AFFICHAGE DU BOUTON POUR AFFICHAGER LES DONNEES ARRIVEES SUR LA CARTE    
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.DrawRect(332, 50, 145,130);    
          lcd.SetBackColor(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.DisplayStringAt(333, LINE(3), (uint8_t *)"The ", LEFT_MODE);
          lcd.DisplayStringAt(333, LINE(4), (uint8_t *)"data", LEFT_MODE);
          lcd.DisplayStringAt(333, LINE(5), (uint8_t *)"display", LEFT_MODE);
      
 //AFFICHAGE DU BOUTON RETOUR        
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.FillRect(30, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(9), (uint8_t *)"BACK", LEFT_MODE);
   //AFFICHAGE DU BOUTON POUR VISUALISER la date
            lcd.SetBackColor(LCD_COLOR_BLACK);
            lcd.SetTextColor(LCD_COLOR_WHITE);
            lcd.DisplayStringAt(400,0 , (uint8_t *)"TIME", LEFT_MODE);
        }
  
 void EcranUtilis_ok()
        {
          lcd.Clear(LCD_COLOR_DARKGRAY);
          lcd.SetBackColor(LCD_COLOR_DARKGRAY);
          lcd.SetTextColor(LCD_COLOR_YELLOW);
          lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"THE DATA DISPLAY", CENTER_MODE);
          
//AFFICHAGE DU BOUTON POUR AFFICHAGER LES DONNEES ARRIVEES SUR LA CARTE    
         lcd.SetTextColor(LCD_COLOR_GREEN);
          lcd.FillRect(25, 75, 180, 30);
          lcd.FillRect(245, 75, 180,30);
          lcd.FillRect(25, 115, 180, 30);
          lcd.FillRect(245, 115, 180,30);
          lcd.FillRect(25, 155, 180, 30);
          lcd.FillRect(245, 155, 180,30);
    lcd.SetBackColor(LCD_COLOR_GREEN);    
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(30,80, (uint8_t *)" Ipanneau", LEFT_MODE);
          lcd.DisplayStringAt(250, 80, (uint8_t *)"Vpanneau", LEFT_MODE);   
          lcd.DisplayStringAt(30,120, (uint8_t *)" Tpanneau", LEFT_MODE);
          lcd.DisplayStringAt(250, 120, (uint8_t *)"Iradiation", LEFT_MODE);
          lcd.DisplayStringAt(30, 160, (uint8_t *)"Vbatterie ", LEFT_MODE);
          lcd.DisplayStringAt(250, 160, (uint8_t *)"Ibatterie", LEFT_MODE);
          
  //AFFICHAGE DU BOUTON RETOUR       
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.FillRect(30, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(9), (uint8_t *)"BACK", LEFT_MODE);
         //AFFICHAGE DU BOUTON POUR VISUALISER la date
            lcd.SetBackColor(LCD_COLOR_BLACK);
            lcd.SetTextColor(LCD_COLOR_WHITE);
            lcd.DisplayStringAt(400,0 , (uint8_t *)"TIME", LEFT_MODE);
    }
    
    void EcranUtilis_fail()
        {
          lcd.Clear(LCD_COLOR_DARKGRAY);
          lcd.SetBackColor(LCD_COLOR_DARKGRAY);
          lcd.SetTextColor(LCD_COLOR_YELLOW);
          lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"THE DATA DISPLAY", CENTER_MODE);
          
//AFFICHAGE DU BOUTON POUR AFFICHAGER LES DONNEES ARRIVEES SUR LA CARTE    
         lcd.SetTextColor(LCD_COLOR_RED);
          lcd.FillRect(25, 75, 180, 30);
          lcd.FillRect(245, 75, 180,30);
          lcd.FillRect(25, 115, 180, 30);
          lcd.FillRect(245, 115, 180,30);
          lcd.FillRect(25, 155, 180, 30);
          lcd.FillRect(245, 155, 180,30);
    lcd.SetBackColor(LCD_COLOR_RED);    
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(30,80, (uint8_t *)" Ipanneau", LEFT_MODE);
          lcd.DisplayStringAt(250, 80, (uint8_t *)"Vpanneau", LEFT_MODE);   
          lcd.DisplayStringAt(30,120, (uint8_t *)" Tpanneau", LEFT_MODE);
          lcd.DisplayStringAt(250, 120, (uint8_t *)"Iradiation", LEFT_MODE);
          lcd.DisplayStringAt(30, 160, (uint8_t *)"Vbatterie ", LEFT_MODE);
          lcd.DisplayStringAt(250, 160, (uint8_t *)"Ibatterie", LEFT_MODE);
          
  //AFFICHAGE DU BOUTON RETOUR       
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.FillRect(30, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(9), (uint8_t *)"BACK", LEFT_MODE);
          //AFFICHAGE DU BOUTON POUR VISUALISER la date
            lcd.SetBackColor(LCD_COLOR_BLACK);
            lcd.SetTextColor(LCD_COLOR_WHITE);
            lcd.DisplayStringAt(400,0 , (uint8_t *)"TIME", LEFT_MODE);
    }
 ///////FONCTION QUI AFFICHE LE NOUVEL ECRAN APRES L'APPUIE DE SUR TIME DATE 


        void Ecran2()
         {
           DS1338 ds1338(D14,D15);
           struct tm time;
           
           
        lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"DATE:", LEFT_MODE);
          sprintf((char*)jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)mois,"%02d",time.tm_mon);
          lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)annee,"%04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
          
          lcd.DisplayStringAt(30, 135, (uint8_t *)"TIME:", LEFT_MODE);
          sprintf((char*)heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
          lcd.DisplayStringAt(115, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)seconde,"%02d",time.tm_sec);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);
              
 
  //AFFICHAGE DU BOUTON QUITTER              
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.FillRect(30, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30,LINE(9), (uint8_t *)"BACK", LEFT_MODE);
         
  }
  
  void reg_time(){
       struct tm time;
       int i=0;
      while (true) {
        
        DS1338 ds1338(D14,D15);
        lcd.SetTextColor(LCD_COLOR_WHITE);
        sprintf((char*)date, "%s", asctime(&time));
        lcd.DisplayStringAt(0, LINE(1), (uint8_t *)date, LEFT_MODE);
        
       // sprintf((char*)date, "Touches: %s",time.tm_mday);
        wait(0.5);
        ds1338.readTime(&time);
        
        lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          

  //AFFICHAGE DU BOUTON QUITTER              
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.FillRect(30, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30,LINE(9), (uint8_t *)"BACK", LEFT_MODE);
          if(i++==10)
          break;
          
   }        }
  
  void Ecran2_Day()
          {
                struct tm time;
               lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"DATE:", LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)mois,"%02d",time.tm_mon);
          lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)annee,"%04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
          
          lcd.DisplayStringAt(30, 135, (uint8_t *)"TIME:", LEFT_MODE);
          sprintf((char*)heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
          lcd.DisplayStringAt(115, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)seconde,"%02d ",time.tm_sec);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);
          
          lcd.SetBackColor(LCD_COLOR_BLUE);  
          sprintf((char*)jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
 
 
          
 //AFFICHAGE DU BOUTON POUR AUGMENTER   
          lcd.SetTextColor(LCD_COLOR_DARKBLUE);
          lcd.FillRect(145, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKBLUE);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(145, LINE(9), (uint8_t *)"  - ", LEFT_MODE);
      
          
//AFFICHAGE DU BOUTON POUR DIMINUER
          lcd.SetTextColor(LCD_COLOR_DARKMAGENTA);
          lcd.FillRect(245, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKMAGENTA);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(245, LINE(9), (uint8_t *)"  + ", LEFT_MODE);
 
//AFFICHAGE DU BOUTON OK            
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.FillRect(360, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKGREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(360, LINE(9), (uint8_t *)" OK ", LEFT_MODE); 
           
           
          }
          
  void Ecran2_Month()
          {
              struct tm time;
              lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"DATE:", LEFT_MODE);
          sprintf((char*)jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)annee,"%04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
          lcd.DisplayStringAt(30, 135, (uint8_t *)"TIME:", LEFT_MODE);
          sprintf((char*)heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(65, 115, (uint8_t *)":", LEFT_MODE);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
          sprintf((char*)seconde,"%02d",time.tm_sec);
          lcd.DisplayStringAt(115, 164, (uint8_t *)"/", LEFT_MODE);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);         
 
          lcd.SetBackColor(LCD_COLOR_BLUE); 
          sprintf((char*)mois,"%02d",time.tm_mon);
        lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          
 //AFFICHAGE DU BOUTON POUR AUGMENTER   
          lcd.SetTextColor(LCD_COLOR_DARKBLUE);
          lcd.FillRect(145, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKBLUE);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(145, LINE(9), (uint8_t *)"  - ", LEFT_MODE);
      
          
//AFFICHAGE DU BOUTON POUR DIMINUER
          lcd.SetTextColor(LCD_COLOR_DARKMAGENTA);
          lcd.FillRect(245, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKMAGENTA);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(245, LINE(9), (uint8_t *)"  + ", LEFT_MODE);
 
//AFFICHAGE DU BOUTON OK            
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.FillRect(360, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKGREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(360, LINE(9), (uint8_t *)" OK ", LEFT_MODE); 
            
            
           
          }

 void Ecran2_Year()
          {
               struct tm time;
               lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"DATE:", LEFT_MODE);
          sprintf((char*)jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)mois,"%02d",time.tm_mon);
          lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          lcd.DisplayStringAt(30, 135, (uint8_t *)"TIME:", LEFT_MODE);
          sprintf((char*)heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
          lcd.DisplayStringAt(115, 164, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)seconde,"%02d",time.tm_sec);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);
                 
          lcd.SetBackColor(LCD_COLOR_BLUE); 
          sprintf((char*)annee,"%04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
     
 
          
 //AFFICHAGE DU BOUTON POUR AUGMENTER   
          lcd.SetTextColor(LCD_COLOR_DARKBLUE);
          lcd.FillRect(145, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKBLUE);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(145, LINE(9), (uint8_t *)"  - ", LEFT_MODE);
      
          
//AFFICHAGE DU BOUTON POUR DIMINUER
          lcd.SetTextColor(LCD_COLOR_DARKMAGENTA);
          lcd.FillRect(245, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKMAGENTA);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(245, LINE(9), (uint8_t *)"  + ", LEFT_MODE);
 
//AFFICHAGE DU BOUTON OK            
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.FillRect(360, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKGREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(360, LINE(9), (uint8_t *)" OK ", LEFT_MODE); 
     
     
           
          }         

 void Ecran2_Hour()
          { 
              struct tm time;
             lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"DATE:", LEFT_MODE);
          sprintf((char*)jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)mois,"%02d",time.tm_mon);
          lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf((char*)annee,"%04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
          lcd.DisplayStringAt(30, 135, (uint8_t *)"TIME:", LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
          lcd.DisplayStringAt(115, 164, (uint8_t *)":", LEFT_MODE);
          sprintf((char*)seconde,"%02d",time.tm_sec);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);
    
          lcd.SetBackColor(LCD_COLOR_BLUE); 
          sprintf((char*)heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          
 
          
 //AFFICHAGE DU BOUTON POUR AUGMENTER   
          lcd.SetTextColor(LCD_COLOR_DARKBLUE);
          lcd.FillRect(145, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKBLUE);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(145, LINE(9), (uint8_t *)"  - ", LEFT_MODE);
      
          
//AFFICHAGE DU BOUTON POUR DIMINUER
          lcd.SetTextColor(LCD_COLOR_DARKMAGENTA);
          lcd.FillRect(245, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKMAGENTA);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(245, LINE(9), (uint8_t *)"  + ", LEFT_MODE);
 
//AFFICHAGE DU BOUTON OK            
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.FillRect(360, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKGREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(360, LINE(9), (uint8_t *)" OK ", LEFT_MODE); 
           
           
           
          }  

 void Ecran2_Minutes()
          {
             struct tm time;
           lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"DATE:", LEFT_MODE);
          sprintf(jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf(mois,"%02d",time.tm_mon);
          lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf(annee,"%04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
          lcd.DisplayStringAt(30, 135, (uint8_t *)"TIME:", LEFT_MODE);
          sprintf(heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          lcd.DisplayStringAt(115, 164, (uint8_t *)":", LEFT_MODE);
          sprintf(seconde,"%02d",time.tm_sec);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);
                 
          lcd.SetBackColor(LCD_COLOR_BLUE); 
          sprintf(minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
        
 
          
//AFFICHAGE DU BOUTON POUR AUGMENTER   
          lcd.SetTextColor(LCD_COLOR_DARKBLUE);
          lcd.FillRect(145, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKBLUE);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(145, LINE(9), (uint8_t *)"  - ", LEFT_MODE);
      
          
//AFFICHAGE DU BOUTON POUR DIMINUER
          lcd.SetTextColor(LCD_COLOR_DARKMAGENTA);
          lcd.FillRect(245, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKMAGENTA);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(245, LINE(9), (uint8_t *)"  + ", LEFT_MODE);
 
//AFFICHAGE DU BOUTON OK            
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.FillRect(360, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKGREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(360, LINE(9), (uint8_t *)" OK ", LEFT_MODE); 
          }     
         
 void Ecran2_Seconde()
          {
            
                struct tm time;
               lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_BLACK);
          lcd.SetBackColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(2), (uint8_t *)"TIME:", LEFT_MODE);
          sprintf(jour,"%02d",time.tm_mday);
          lcd.DisplayStringAt(30, 82, (uint8_t *)jour, LEFT_MODE);
          lcd.DisplayStringAt(65, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf(mois,"%02d",time.tm_mon);
          lcd.DisplayStringAt(80, 82, (uint8_t *) mois, LEFT_MODE);
          lcd.DisplayStringAt(115, 82, (uint8_t *)"/", LEFT_MODE);
          sprintf(annee," %04d",time.tm_year);
          lcd.DisplayStringAt(130, 82, (uint8_t *)annee, LEFT_MODE);
          lcd.DisplayStringAt(30, 135, (uint8_t *)"DATE:", LEFT_MODE);
          sprintf(heure,"%02d",time.tm_hour);
          lcd.DisplayStringAt(30, 164, (uint8_t *)heure, LEFT_MODE);
          lcd.DisplayStringAt(65, 164, (uint8_t *)":", LEFT_MODE);
          sprintf(minute,"%02d",time.tm_min);
          lcd.DisplayStringAt(80, 164, (uint8_t *)minute, LEFT_MODE);
          lcd.DisplayStringAt(115, 164, (uint8_t *)":", LEFT_MODE);
         
          lcd.SetBackColor(LCD_COLOR_BLUE); 
           sprintf(seconde,"%02d ",time.tm_sec);
          lcd.DisplayStringAt(130, 164, (uint8_t *)seconde, LEFT_MODE);
              
 
          
//AFFICHAGE DU BOUTON POUR AUGMENTER   
          lcd.SetTextColor(LCD_COLOR_DARKBLUE);
          lcd.FillRect(145, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKBLUE);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(145, LINE(9), (uint8_t *)"  - ", LEFT_MODE);
      
          
//AFFICHAGE DU BOUTON POUR DIMINUER
          lcd.SetTextColor(LCD_COLOR_DARKMAGENTA);
          lcd.FillRect(245, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKMAGENTA);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(245, LINE(9), (uint8_t *)"  + ", LEFT_MODE);
 
//AFFICHAGE DU BOUTON OK            
          lcd.SetTextColor(LCD_COLOR_DARKGREEN);
          lcd.FillRect(360, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKGREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(360, LINE(9), (uint8_t *)" OK ", LEFT_MODE);  
           }         
           
          
///////FONCTION QUI AFFICHE LE NOUVEL ECRAN APRES L'APPUIE DE SUR FREQ           
          void Ecran3()
          {
              
          lcd.Clear(LCD_COLOR_WHITE);
          lcd.SetBackColor(LCD_COLOR_WHITE);
          lcd.SetTextColor(LCD_COLOR_DARKGRAY);
          lcd.DisplayStringAt(10, LINE(1), (uint8_t *)"Select the frequency of", CENTER_MODE);
          lcd.DisplayStringAt(10, LINE(2), (uint8_t *)"sending of the data on the", CENTER_MODE);
          lcd.DisplayStringAt(10, LINE(3), (uint8_t *)"SD card: ", CENTER_MODE);
          lcd.SetBackColor(LCD_COLOR_GREEN);
          lcd.DisplayStringAt(30,120, (uint8_t *)"Acquire ", LEFT_MODE);
          lcd.SetBackColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(250, 120, (uint8_t *)"Per day", LEFT_MODE);
          lcd.DisplayStringAt(30, 160, (uint8_t *)"Per week ", LEFT_MODE);
          lcd.DisplayStringAt(250, 160, (uint8_t *)"Per month", LEFT_MODE);
          
          
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.DrawRect(25, 115, 160, 30);
          lcd.DrawRect(245, 115, 160,30);
          lcd.DrawRect(25, 155, 160, 30);
          lcd.DrawRect(245, 155, 160,30);
        
  //AFFICHAGE DU BOUTON RETOUR             
         
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(9), (uint8_t *)"BACK", LEFT_MODE); 
          
           //AFFICHAGE DU BOUTON POUR VISUALISER la date
            lcd.SetBackColor(LCD_COLOR_BLACK);
            lcd.SetTextColor(LCD_COLOR_WHITE);
            lcd.DisplayStringAt(400,0 , (uint8_t *)"TIME", LEFT_MODE);
           }
           
           void Ecran3_PerHour()
          {
             
           }
            void Ecran3_PerDay()
          {
             
           }
            void Ecran3_PerWeek()
          {
             
           }
            void Ecran3_PerMonth()
          {
             
           }
           
////FONCTION QUI AFFICHE LE MOT DE PASSE///////
void MotDePasse()
{ 
   lcd.Clear(LCD_COLOR_WHITE);
   lcd.SetBackColor(LCD_COLOR_WHITE);
   lcd.SetTextColor(LCD_COLOR_BLACK);
   lcd.DisplayStringAt(0, LINE(1), (uint8_t *)" PASSWORD: ",LEFT_MODE);

         lcd.SetTextColor(LCD_COLOR_BLACK);
         lcd.FillRect(120, 80, 240, 160);
         
          lcd.SetBackColor(LCD_COLOR_DARKGRAY);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(135,90, (uint8_t *)" 1 ", LEFT_MODE);
          lcd.DisplayStringAt(215, 90, (uint8_t *)" 2 ", LEFT_MODE); 
          lcd.DisplayStringAt(295, 90, (uint8_t *)" 3 ", LEFT_MODE);   
          lcd.DisplayStringAt(135,130, (uint8_t *)" 4 ", LEFT_MODE);
          lcd.DisplayStringAt(215, 130, (uint8_t *)" 5 ", LEFT_MODE);
          lcd.DisplayStringAt(295, 130, (uint8_t *)" 6 ", LEFT_MODE);
          lcd.DisplayStringAt(135, 170, (uint8_t *)" 7 ", LEFT_MODE);
          lcd.DisplayStringAt(215, 170, (uint8_t *)" 8 ", LEFT_MODE);
          lcd.DisplayStringAt(295, 170, (uint8_t *)" 9 ", LEFT_MODE);
          
          lcd.SetBackColor(LCD_COLOR_GREEN);
          lcd.SetTextColor(LCD_COLOR_WHITE);
          lcd.DisplayStringAt(210, 210, (uint8_t *)" OK ", LEFT_MODE);
                
 //AFFICHAGE DU BOUTON RETOUR        
          lcd.SetTextColor(LCD_COLOR_DARKRED);
          lcd.FillRect(30, 210, 80,30);
          lcd.SetBackColor(LCD_COLOR_DARKRED);
          lcd.SetTextColor(LCD_COLOR_WHITE); 
          lcd.DisplayStringAt(30, LINE(9), (uint8_t *)"BACK", LEFT_MODE);
 }
 ///////////////////////////////////////////////////////////////////