prog
Dependencies: SRF08 TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG
Revision 0:0a8311d5dc40, committed 2020-06-30
- Comitter:
- Seb1793
- Date:
- Tue Jun 30 15:08:18 2020 +0000
- Commit message:
- Prog_interfacage
Changed in this revision
diff -r 000000000000 -r 0a8311d5dc40 BSP_DISCO_F746NG.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F746NG.lib Tue Jun 30 15:08:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
diff -r 000000000000 -r 0a8311d5dc40 LCD_DISCO_F746NG.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F746NG.lib Tue Jun 30 15:08:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/LCD_DISCO_F746NG/#d44525b1de98
diff -r 000000000000 -r 0a8311d5dc40 SRF08.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SRF08.lib Tue Jun 30 15:08:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/chris/code/SRF08/#aeec981d1d2a
diff -r 000000000000 -r 0a8311d5dc40 TS_DISCO_F746NG.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F746NG.lib Tue Jun 30 15:08:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/TS_DISCO_F746NG/#fe0cf5e2960f
diff -r 000000000000 -r 0a8311d5dc40 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 30 15:08:18 2020 +0000 @@ -0,0 +1,107 @@ +#include "mbed.h" +#include "TS_DISCO_F746NG.h" +#include "LCD_DISCO_F746NG.h" +#include "SRF08.h" + + +TS_DISCO_F746NG ts; +LCD_DISCO_F746NG lcd; +SRF08 srf08(PB_9, PB_8, 0xE0); +DigitalOut led1(LED1); + + +int main() +{ + TS_StateTypeDef TS_State; + + ts.Init(420, 272); + bool flag = 0,flag1=0; + char machaine[50] = {0}; + float capteur_f = 0; + + while(1) { + + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"CAPTEUR ULTRASON", CENTER_MODE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"ALARM JEU VALEUR CAPTEUR", CENTER_MODE); + ts.GetState(&TS_State); + if ((TS_State.touchDetected) && (TS_State.touchX[0] > 320)) { + wait(1); + led1 = 1; + flag=1; + lcd.Clear(LCD_COLOR_BLACK); + while(flag!=0) { + ts.GetState(&TS_State); + capteur_f = srf08.read(); + sprintf(machaine,"valeur %f", capteur_f); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)machaine, CENTER_MODE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Retour MENU", CENTER_MODE); + if (TS_State.touchDetected) { + flag=0; + lcd.Clear(LCD_COLOR_BLACK); + } + wait(0.1); + } + } + if ((TS_State.touchDetected) && (TS_State.touchX[0] < 240) && (130 < TS_State.touchX[0])) { + wait(1); + flag1=1; + lcd.Clear(LCD_COLOR_BLACK); + while(flag1!=0) { + ts.GetState(&TS_State); + capteur_f = srf08.read(); + if(capteur_f<4) { + lcd.Clear(LCD_COLOR_BLUE); + } + if((4<=capteur_f)&&(capteur_f<=6)) { + lcd.Clear(LCD_COLOR_GREEN); + } + if((7<=capteur_f)&&(capteur_f<8)) { + lcd.Clear(LCD_COLOR_RED); + } + if((8<=capteur_f)&&(capteur_f<10)) { + lcd.Clear(LCD_COLOR_CYAN); + } + if((10<=capteur_f)&&(capteur_f<=12)) { + lcd.Clear(LCD_COLOR_MAGENTA); + } + if(12<capteur_f) { + lcd.Clear(LCD_COLOR_YELLOW); + } + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Retour MENU", CENTER_MODE); + if (TS_State.touchDetected) { + flag1=0; + lcd.Clear(LCD_COLOR_BLACK); + } + wait(0.1); + } + + } + if ((TS_State.touchDetected) && (TS_State.touchX[0] < 100)) { + wait(1); + led1 = 0; + flag=0; + lcd.Clear(LCD_COLOR_BLACK); + while(flag!=1) { + ts.GetState(&TS_State); + capteur_f = srf08.read(); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Retour MENU", CENTER_MODE); + if(capteur_f<10 && capteur_f!=0) { + lcd.SetBackColor(LCD_COLOR_RED); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"ALERTE INTRUSION", CENTER_MODE); + } + if (TS_State.touchDetected) { + lcd.SetBackColor(LCD_COLOR_BLACK); + flag=1; + lcd.Clear(LCD_COLOR_BLACK); + } + wait(0.1); + + + } + } + + wait(0.1); + } +} \ No newline at end of file
diff -r 000000000000 -r 0a8311d5dc40 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jun 30 15:08:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file