Pour Marc la mignonne
Dependencies: BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed
Touchescreen.cpp@0:fcce18d01987, 2018-05-31 (annotated)
- Committer:
- Alex_mln
- Date:
- Thu May 31 06:11:25 2018 +0000
- Revision:
- 0:fcce18d01987
Tiens pd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alex_mln | 0:fcce18d01987 | 1 | #include "mbed.h" |
Alex_mln | 0:fcce18d01987 | 2 | #include "screen.h" |
Alex_mln | 0:fcce18d01987 | 3 | #include "LCD_DISCO_F429ZI.h" |
Alex_mln | 0:fcce18d01987 | 4 | #include "Touchescreen.h" |
Alex_mln | 0:fcce18d01987 | 5 | |
Alex_mln | 0:fcce18d01987 | 6 | LCD_DISCO_F429ZI lcdt; |
Alex_mln | 0:fcce18d01987 | 7 | //DigitalOut led1(LED1); |
Alex_mln | 0:fcce18d01987 | 8 | |
Alex_mln | 0:fcce18d01987 | 9 | |
Alex_mln | 0:fcce18d01987 | 10 | // marchent : PF9 PF7 PF8 PC4 PC0 PC1 PC2 PC3 PA7 PC5 |
Alex_mln | 0:fcce18d01987 | 11 | |
Alex_mln | 0:fcce18d01987 | 12 | /* |
Alex_mln | 0:fcce18d01987 | 13 | |
Alex_mln | 0:fcce18d01987 | 14 | //Premiere rangée de capteur |
Alex_mln | 0:fcce18d01987 | 15 | AnalogIn capt11(PF_7); |
Alex_mln | 0:fcce18d01987 | 16 | AnalogIn capt12(PF_8); |
Alex_mln | 0:fcce18d01987 | 17 | AnalogIn capt13(PF_9); |
Alex_mln | 0:fcce18d01987 | 18 | |
Alex_mln | 0:fcce18d01987 | 19 | //Deuxieme rangée de capteur |
Alex_mln | 0:fcce18d01987 | 20 | AnalogIn capt21(PC_4); |
Alex_mln | 0:fcce18d01987 | 21 | AnalogIn capt22(PC_1); |
Alex_mln | 0:fcce18d01987 | 22 | AnalogIn capt23(PC_2); |
Alex_mln | 0:fcce18d01987 | 23 | |
Alex_mln | 0:fcce18d01987 | 24 | //Troisième rangée de capteur |
Alex_mln | 0:fcce18d01987 | 25 | AnalogIn capt31(PC_3); |
Alex_mln | 0:fcce18d01987 | 26 | AnalogIn capt32(PA_7); |
Alex_mln | 0:fcce18d01987 | 27 | AnalogIn capt33(PC_5); |
Alex_mln | 0:fcce18d01987 | 28 | |
Alex_mln | 0:fcce18d01987 | 29 | |
Alex_mln | 0:fcce18d01987 | 30 | |
Alex_mln | 0:fcce18d01987 | 31 | |
Alex_mln | 0:fcce18d01987 | 32 | |
Alex_mln | 0:fcce18d01987 | 33 | */ |
Alex_mln | 0:fcce18d01987 | 34 | |
Alex_mln | 0:fcce18d01987 | 35 | |
Alex_mln | 0:fcce18d01987 | 36 | |
Alex_mln | 0:fcce18d01987 | 37 | |
Alex_mln | 0:fcce18d01987 | 38 | |
Alex_mln | 0:fcce18d01987 | 39 | /* |
Alex_mln | 0:fcce18d01987 | 40 | |
Alex_mln | 0:fcce18d01987 | 41 | DigitalOut led(LED1); |
Alex_mln | 0:fcce18d01987 | 42 | DigitalOut test(PA_0); |
Alex_mln | 0:fcce18d01987 | 43 | DigitalOut mot1(PE_12); |
Alex_mln | 0:fcce18d01987 | 44 | DigitalOut mot2(PE_14); |
Alex_mln | 0:fcce18d01987 | 45 | int valeur_neg; |
Alex_mln | 0:fcce18d01987 | 46 | |
Alex_mln | 0:fcce18d01987 | 47 | void init_neg(){ |
Alex_mln | 0:fcce18d01987 | 48 | valeur_neg=(capt11.read()*10000+capt12.read()*10000+capt13.read()*10000)/3; |
Alex_mln | 0:fcce18d01987 | 49 | wait(0.001);} |
Alex_mln | 0:fcce18d01987 | 50 | |
Alex_mln | 0:fcce18d01987 | 51 | */ |
Alex_mln | 0:fcce18d01987 | 52 | |
Alex_mln | 0:fcce18d01987 | 53 | |
Alex_mln | 0:fcce18d01987 | 54 | |
Alex_mln | 0:fcce18d01987 | 55 | |
Alex_mln | 0:fcce18d01987 | 56 | void affichage(int valeur,int place){ |
Alex_mln | 0:fcce18d01987 | 57 | /* float value=0; |
Alex_mln | 0:fcce18d01987 | 58 | float value1=0; |
Alex_mln | 0:fcce18d01987 | 59 | float value2=0; |
Alex_mln | 0:fcce18d01987 | 60 | float value3=0; |
Alex_mln | 0:fcce18d01987 | 61 | screen_init(); |
Alex_mln | 0:fcce18d01987 | 62 | lcd.Clear(LCD_COLOR_GREEN); |
Alex_mln | 0:fcce18d01987 | 63 | init_neg(); |
Alex_mln | 0:fcce18d01987 | 64 | while(1){ |
Alex_mln | 0:fcce18d01987 | 65 | value1 = capt11.read()*10000; |
Alex_mln | 0:fcce18d01987 | 66 | value2 = capt12.read()*10000; |
Alex_mln | 0:fcce18d01987 | 67 | value3 = capt13.read()*10000;*/ |
Alex_mln | 0:fcce18d01987 | 68 | showIntegerScreen((int)(valeur),place,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 69 | /* showIntegerScreen((int)(value2),3,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 70 | showIntegerScreen((int)(value3),4,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 71 | showIntegerScreen(valeur_neg,0,0,LEFT_MODE); |
Alex_mln | 0:fcce18d01987 | 72 | value=(value1+value2+value3)/3; |
Alex_mln | 0:fcce18d01987 | 73 | |
Alex_mln | 0:fcce18d01987 | 74 | value1 = capt21.read()*10000; |
Alex_mln | 0:fcce18d01987 | 75 | value2 = capt22.read()*10000; |
Alex_mln | 0:fcce18d01987 | 76 | value3 = capt23.read()*10000; |
Alex_mln | 0:fcce18d01987 | 77 | showIntegerScreen((int)(value1),5,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 78 | showIntegerScreen((int)(value2),6,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 79 | showIntegerScreen((int)(value3),7,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 80 | |
Alex_mln | 0:fcce18d01987 | 81 | value1 = capt31.read()*10000; |
Alex_mln | 0:fcce18d01987 | 82 | value2 = capt32.read()*10000; |
Alex_mln | 0:fcce18d01987 | 83 | value3 = capt33.read()*10000; |
Alex_mln | 0:fcce18d01987 | 84 | showIntegerScreen((int)(value1),8,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 85 | showIntegerScreen((int)(value2),9,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 86 | showIntegerScreen((int)(value3),10,0,CENTER_MODE); |
Alex_mln | 0:fcce18d01987 | 87 | if(value>valeur_neg){ |
Alex_mln | 0:fcce18d01987 | 88 | test=1;} |
Alex_mln | 0:fcce18d01987 | 89 | else{ |
Alex_mln | 0:fcce18d01987 | 90 | test=0;} |
Alex_mln | 0:fcce18d01987 | 91 | mot1=1; |
Alex_mln | 0:fcce18d01987 | 92 | mot2=0; |
Alex_mln | 0:fcce18d01987 | 93 | wait(2); |
Alex_mln | 0:fcce18d01987 | 94 | mot1=1; |
Alex_mln | 0:fcce18d01987 | 95 | mot2=1; |
Alex_mln | 0:fcce18d01987 | 96 | wait(0.5); |
Alex_mln | 0:fcce18d01987 | 97 | mot1=0; |
Alex_mln | 0:fcce18d01987 | 98 | mot2=1; |
Alex_mln | 0:fcce18d01987 | 99 | wait(2); |
Alex_mln | 0:fcce18d01987 | 100 | mot1=0; |
Alex_mln | 0:fcce18d01987 | 101 | mot2=0; |
Alex_mln | 0:fcce18d01987 | 102 | wait(1); |
Alex_mln | 0:fcce18d01987 | 103 | |
Alex_mln | 0:fcce18d01987 | 104 | */ |
Alex_mln | 0:fcce18d01987 | 105 | |
Alex_mln | 0:fcce18d01987 | 106 | wait(0.1); |
Alex_mln | 0:fcce18d01987 | 107 | } |