Correction

Dependencies:   mbed LCD_DISCO_F746NG BSP_DISCO_F746NG

main.cpp

Committer:
jlpadiolleau
Date:
2017-10-14
Revision:
1:1ad205209b9c
Parent:
0:617db635305b

File content as of revision 1:1ad205209b9c:

#include "mbed.h"
#include "LCD_DISCO_F746NG.h"
#include <stdio.h>

LCD_DISCO_F746NG lcd; // Instanciation du LCD
DigitalIn button1(USER_BUTTON);
Serial pc(USBTX, USBRX); // tx, rx

int main()
{  
    bool flag=false;
    uint8_t cnt=0;
    lcd.SetTextColor(LCD_COLOR_RED);
    
    while(1)
    {
        if (button1)
        {
            printf("button1 is on\n");
            if(!flag)
            {
                printf("button1 rising edge\n");
                flag=true;
                cnt++;
                printf("Valeur de cnt = %d\n",cnt);
               
            }
        }
        else
        {
            flag=false;
        }   
        if(cnt==10)
        {
             
            lcd.Clear(LCD_COLOR_GREEN);
            lcd.SetBackColor(LCD_COLOR_GREEN);
            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"VOTRE MISSION CONSISTE A    ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"PROUVER LA FABRICATION      ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(2), (uint8_t *)"D'UNE ARME SECRETE          ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"REDOUTABLE DANS CE PAYS.    ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"ALLEZ DANS LES LABORATOIRES ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"SECRETS DE LA CAPITALE      ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"ET FAITES DES PHOTOS QUE    ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"VOUS TRANMETTREZ A NOTRE    ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"AGENCE DANS LE PAYS VOISIN. ", LEFT_MODE);
            lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"BONNE CHANCE AGENT 567",CENTER_MODE);
            wait(10);
            lcd.Clear(LCD_COLOR_WHITE);
            cnt=0;
        }
        else
        {
            lcd.FillCircle(240,136,50);
            wait(0.1);
            lcd.Clear(LCD_COLOR_WHITE);
            wait(0.1);
        }
    }
}