Quentin LAM / Mbed 2 deprecated ex17

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "Nboard.h"
00002 #include "IHM.h"
00003 IHM ihm;
00004 
00005 int main()
00006 {
00007     float n= 0.1;
00008     int motif=1,sar=0;
00009     int position;
00010     while(1) {
00011         while(motif<0x200) {
00012             motif=motif<<1;
00013             ihm.BAR_set(motif);
00014             position = ihm.JOG_read();
00015              if(position==0x04) {
00016                 while(position==0x04){}
00017                     ihm.LCD_gotoxy(0,0);
00018                     ihm.LCD_printf("pause  ");
00019                     sar=1;
00020                 }
00021                 while(sar==1){
00022                     if (position==0x04) {
00023                     while(position==0x04){}
00024                     ihm.LCD_gotoxy(0,0);
00025                     ihm.LCD_printf("play  ");
00026                     sar=0;}}
00027             
00028             wait(n);
00029         }
00030 
00031         while(motif>0x1) {
00032             motif=motif>>1;
00033             ihm.BAR_set(motif);
00034             position = ihm.JOG_read();
00035              if(position==0x04) {
00036                 while(position==0x04){}
00037                     ihm.LCD_gotoxy(0,0);
00038                     ihm.LCD_printf("pause  ");
00039                     sar=1;
00040             }
00041                 while(sar==1){
00042                     if (position==0x04) {
00043                     while(position==0x04){}
00044                     ihm.LCD_gotoxy(0,0);
00045                     ihm.LCD_printf("play  ");
00046                     sar=0;}}
00047             
00048             wait(n);
00049         }
00050 }
00051 }
00052      /*   ihm.LCD_gotoxy(0,0);
00053         switch(position) {
00054             case 0x08 :
00055                 n=n+0.1;
00056                 ihm.LCD_printf("HA%f       ",n);
00057                 break;
00058             case 0x01 :
00059                 n=n-0.1;
00060                 ihm.LCD_printf("B%f        ",n);
00061                 break;
00062             case 0x10 :
00063                 ihm.LCD_printf("DROITE     ");
00064                 break;
00065             case 0x02 :
00066                 ihm.LCD_printf("GAUCHE     ");
00067                 break;
00068             case 0x18 :
00069                 ihm.LCD_printf("HAUT DROITE");
00070                 break;
00071             case 0x0A :
00072                 ihm.LCD_printf("HAUT GAUCHE");
00073                 break;
00074             case 0x03 :
00075                 ihm.LCD_printf("BAS GAUCHE ");
00076                 break;
00077             case 0x11 :
00078                 ihm.LCD_printf("BAS DROITE ");
00079                 break;
00080 
00081         }
00082 
00083     }
00084 }
00085 */