Quentin LAM
/
ex17
Exo
Revision 17:9e3454009d20, committed 2018-05-29
- Comitter:
- Quent1nl
- Date:
- Tue May 29 14:13:27 2018 +0000
- Parent:
- 16:c4bfe797dfaf
- Commit message:
- EX17
Changed in this revision
diff -r c4bfe797dfaf -r 9e3454009d20 Nboard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nboard.h Tue May 29 14:13:27 2018 +0000 @@ -0,0 +1,5 @@ +#include "mbed.h" + +DigitalOut led0(PB_3), led1(PA_7),led2(PA_6),led3(PA_5),led4(PA_3),led5(PA_1),led6(PA_0),led7(PA_2); +DigitalIn bp(PA_9, PullUp),bp1(PA_10,PullUp),bp2(PB_0,PullUp),bp3(PB_7,PullUp); +BusOut Bus8Leds(PB_3,PA_7,PA_6,PA_5,PA_3,PA_1,PA_0,PA_2); \ No newline at end of file
diff -r c4bfe797dfaf -r 9e3454009d20 Nboard_IHM.cpp --- a/Nboard_IHM.cpp Tue Nov 08 11:07:32 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#include "IHM.h" -IHM ihm; //clase IHM -Serial pc(USBTX, USBRX); // I/O terminal PC -int main() -{ - UINT8 codeur=0,jog; - float pi=4*atan(1.0); - ihm.LCD_gotoxy(0,1); - pc.printf("Hello IHMV1 \n"); - ihm.LCD_clear(); - ihm.LCD_gotoxy(0,0); - ihm.LCD_printf("Hello IHM V1"); - ihm.LCD_gotoxy(1,0); - ihm.LCD_printf("PI= %f",pi); // test affichage float - ihm.BAR_set(0x3FF); - wait(2); - ihm.BAR_set(0x2AA); - wait(2); - ihm.BAR_set(0x155); - wait(2); - ihm.LCD_clear(); - while(1) { - wait(0.5); - codeur=ihm.COD_read(); - jog=ihm.JOG_read(); - ihm.BAR_set((UINT16)(codeur)); - ihm.LCD_gotoxy(0,0); - ihm.LCD_printf("Jog=%02d",jog); - ihm.LCD_gotoxy(1,0); - ihm.LCD_printf("Cod=%03d",codeur); - pc.printf("Jog=%02d Cod=%03d \n",jog,codeur); - } -}
diff -r c4bfe797dfaf -r 9e3454009d20 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 29 14:13:27 2018 +0000 @@ -0,0 +1,85 @@ +#include "Nboard.h" +#include "IHM.h" +IHM ihm; + +int main() +{ + float n= 0.1; + int motif=1,sar=0; + int position; + while(1) { + while(motif<0x200) { + motif=motif<<1; + ihm.BAR_set(motif); + position = ihm.JOG_read(); + if(position==0x04) { + while(position==0x04){} + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("pause "); + sar=1; + } + while(sar==1){ + if (position==0x04) { + while(position==0x04){} + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("play "); + sar=0;}} + + wait(n); + } + + while(motif>0x1) { + motif=motif>>1; + ihm.BAR_set(motif); + position = ihm.JOG_read(); + if(position==0x04) { + while(position==0x04){} + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("pause "); + sar=1; + } + while(sar==1){ + if (position==0x04) { + while(position==0x04){} + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("play "); + sar=0;}} + + wait(n); + } +} +} + /* ihm.LCD_gotoxy(0,0); + switch(position) { + case 0x08 : + n=n+0.1; + ihm.LCD_printf("HA%f ",n); + break; + case 0x01 : + n=n-0.1; + ihm.LCD_printf("B%f ",n); + break; + case 0x10 : + ihm.LCD_printf("DROITE "); + break; + case 0x02 : + ihm.LCD_printf("GAUCHE "); + break; + case 0x18 : + ihm.LCD_printf("HAUT DROITE"); + break; + case 0x0A : + ihm.LCD_printf("HAUT GAUCHE"); + break; + case 0x03 : + ihm.LCD_printf("BAS GAUCHE "); + break; + case 0x11 : + ihm.LCD_printf("BAS DROITE "); + break; + + } + + } +} +*/