Correction
Dependencies: mbed LCD_DISCO_F746NG BSP_DISCO_F746NG
Revision 1:1ad205209b9c, committed 2017-10-14
- Comitter:
- jlpadiolleau
- Date:
- Sat Oct 14 06:59:17 2017 +0000
- Parent:
- 0:617db635305b
- Commit message:
- Correction de la partie B du TP2
Changed in this revision
TS_DISCO_F746NG.lib | Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/TS_DISCO_F746NG.lib Mon Oct 02 16:45:54 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://mbed.org/teams/ST/code/TS_DISCO_F746NG/#fe0cf5e2960f
--- a/main.cpp Mon Oct 02 16:45:54 2017 +0000 +++ b/main.cpp Sat Oct 14 06:59:17 2017 +0000 @@ -1,41 +1,60 @@ #include "mbed.h" #include "LCD_DISCO_F746NG.h" -#include "TS_DISCO_F746NG.h" -#include "SDFileSystem.h" #include <stdio.h> LCD_DISCO_F746NG lcd; // Instanciation du LCD +DigitalIn button1(USER_BUTTON); Serial pc(USBTX, USBRX); // tx, rx -//SDFileSystem sd("sd"); int main() { - lcd.Clear(LCD_COLOR_GREEN); - lcd.SetBackColor(LCD_COLOR_GREEN); + bool flag=false; + uint8_t cnt=0; lcd.SetTextColor(LCD_COLOR_RED); - printf("Debut de la phase d'intialisation\n"); - 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); - printf("Fin de la phase d'intialisation\n"); - wait(10); - lcd.Clear(LCD_COLOR_WHITE); - //lcd.DrawBitmap(0,0,(uint8_t *)"/sd/koala.bmp"); - wait(5); - lcd.Clear(LCD_COLOR_WHITE); + while(1) { - printf("Boucle sans fin\n"); - lcd.FillCircle(240,136,50); - wait(0.2); - lcd.Clear(LCD_COLOR_WHITE); - wait(0.2); + 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); + } } }