Quentin LAM
/
ex17
Exo
main.cpp@17:9e3454009d20, 2018-05-29 (annotated)
- Committer:
- Quent1nl
- Date:
- Tue May 29 14:13:27 2018 +0000
- Revision:
- 17:9e3454009d20
EX17
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Quent1nl | 17:9e3454009d20 | 1 | #include "Nboard.h" |
Quent1nl | 17:9e3454009d20 | 2 | #include "IHM.h" |
Quent1nl | 17:9e3454009d20 | 3 | IHM ihm; |
Quent1nl | 17:9e3454009d20 | 4 | |
Quent1nl | 17:9e3454009d20 | 5 | int main() |
Quent1nl | 17:9e3454009d20 | 6 | { |
Quent1nl | 17:9e3454009d20 | 7 | float n= 0.1; |
Quent1nl | 17:9e3454009d20 | 8 | int motif=1,sar=0; |
Quent1nl | 17:9e3454009d20 | 9 | int position; |
Quent1nl | 17:9e3454009d20 | 10 | while(1) { |
Quent1nl | 17:9e3454009d20 | 11 | while(motif<0x200) { |
Quent1nl | 17:9e3454009d20 | 12 | motif=motif<<1; |
Quent1nl | 17:9e3454009d20 | 13 | ihm.BAR_set(motif); |
Quent1nl | 17:9e3454009d20 | 14 | position = ihm.JOG_read(); |
Quent1nl | 17:9e3454009d20 | 15 | if(position==0x04) { |
Quent1nl | 17:9e3454009d20 | 16 | while(position==0x04){} |
Quent1nl | 17:9e3454009d20 | 17 | ihm.LCD_gotoxy(0,0); |
Quent1nl | 17:9e3454009d20 | 18 | ihm.LCD_printf("pause "); |
Quent1nl | 17:9e3454009d20 | 19 | sar=1; |
Quent1nl | 17:9e3454009d20 | 20 | } |
Quent1nl | 17:9e3454009d20 | 21 | while(sar==1){ |
Quent1nl | 17:9e3454009d20 | 22 | if (position==0x04) { |
Quent1nl | 17:9e3454009d20 | 23 | while(position==0x04){} |
Quent1nl | 17:9e3454009d20 | 24 | ihm.LCD_gotoxy(0,0); |
Quent1nl | 17:9e3454009d20 | 25 | ihm.LCD_printf("play "); |
Quent1nl | 17:9e3454009d20 | 26 | sar=0;}} |
Quent1nl | 17:9e3454009d20 | 27 | |
Quent1nl | 17:9e3454009d20 | 28 | wait(n); |
Quent1nl | 17:9e3454009d20 | 29 | } |
Quent1nl | 17:9e3454009d20 | 30 | |
Quent1nl | 17:9e3454009d20 | 31 | while(motif>0x1) { |
Quent1nl | 17:9e3454009d20 | 32 | motif=motif>>1; |
Quent1nl | 17:9e3454009d20 | 33 | ihm.BAR_set(motif); |
Quent1nl | 17:9e3454009d20 | 34 | position = ihm.JOG_read(); |
Quent1nl | 17:9e3454009d20 | 35 | if(position==0x04) { |
Quent1nl | 17:9e3454009d20 | 36 | while(position==0x04){} |
Quent1nl | 17:9e3454009d20 | 37 | ihm.LCD_gotoxy(0,0); |
Quent1nl | 17:9e3454009d20 | 38 | ihm.LCD_printf("pause "); |
Quent1nl | 17:9e3454009d20 | 39 | sar=1; |
Quent1nl | 17:9e3454009d20 | 40 | } |
Quent1nl | 17:9e3454009d20 | 41 | while(sar==1){ |
Quent1nl | 17:9e3454009d20 | 42 | if (position==0x04) { |
Quent1nl | 17:9e3454009d20 | 43 | while(position==0x04){} |
Quent1nl | 17:9e3454009d20 | 44 | ihm.LCD_gotoxy(0,0); |
Quent1nl | 17:9e3454009d20 | 45 | ihm.LCD_printf("play "); |
Quent1nl | 17:9e3454009d20 | 46 | sar=0;}} |
Quent1nl | 17:9e3454009d20 | 47 | |
Quent1nl | 17:9e3454009d20 | 48 | wait(n); |
Quent1nl | 17:9e3454009d20 | 49 | } |
Quent1nl | 17:9e3454009d20 | 50 | } |
Quent1nl | 17:9e3454009d20 | 51 | } |
Quent1nl | 17:9e3454009d20 | 52 | /* ihm.LCD_gotoxy(0,0); |
Quent1nl | 17:9e3454009d20 | 53 | switch(position) { |
Quent1nl | 17:9e3454009d20 | 54 | case 0x08 : |
Quent1nl | 17:9e3454009d20 | 55 | n=n+0.1; |
Quent1nl | 17:9e3454009d20 | 56 | ihm.LCD_printf("HA%f ",n); |
Quent1nl | 17:9e3454009d20 | 57 | break; |
Quent1nl | 17:9e3454009d20 | 58 | case 0x01 : |
Quent1nl | 17:9e3454009d20 | 59 | n=n-0.1; |
Quent1nl | 17:9e3454009d20 | 60 | ihm.LCD_printf("B%f ",n); |
Quent1nl | 17:9e3454009d20 | 61 | break; |
Quent1nl | 17:9e3454009d20 | 62 | case 0x10 : |
Quent1nl | 17:9e3454009d20 | 63 | ihm.LCD_printf("DROITE "); |
Quent1nl | 17:9e3454009d20 | 64 | break; |
Quent1nl | 17:9e3454009d20 | 65 | case 0x02 : |
Quent1nl | 17:9e3454009d20 | 66 | ihm.LCD_printf("GAUCHE "); |
Quent1nl | 17:9e3454009d20 | 67 | break; |
Quent1nl | 17:9e3454009d20 | 68 | case 0x18 : |
Quent1nl | 17:9e3454009d20 | 69 | ihm.LCD_printf("HAUT DROITE"); |
Quent1nl | 17:9e3454009d20 | 70 | break; |
Quent1nl | 17:9e3454009d20 | 71 | case 0x0A : |
Quent1nl | 17:9e3454009d20 | 72 | ihm.LCD_printf("HAUT GAUCHE"); |
Quent1nl | 17:9e3454009d20 | 73 | break; |
Quent1nl | 17:9e3454009d20 | 74 | case 0x03 : |
Quent1nl | 17:9e3454009d20 | 75 | ihm.LCD_printf("BAS GAUCHE "); |
Quent1nl | 17:9e3454009d20 | 76 | break; |
Quent1nl | 17:9e3454009d20 | 77 | case 0x11 : |
Quent1nl | 17:9e3454009d20 | 78 | ihm.LCD_printf("BAS DROITE "); |
Quent1nl | 17:9e3454009d20 | 79 | break; |
Quent1nl | 17:9e3454009d20 | 80 | |
Quent1nl | 17:9e3454009d20 | 81 | } |
Quent1nl | 17:9e3454009d20 | 82 | |
Quent1nl | 17:9e3454009d20 | 83 | } |
Quent1nl | 17:9e3454009d20 | 84 | } |
Quent1nl | 17:9e3454009d20 | 85 | */ |