Quentin LAM
/
ex21_PWM1
Exo
Revision 0:eabaa36e66b0, committed 2018-05-29
- Comitter:
- Quent1nl
- Date:
- Tue May 29 14:14:42 2018 +0000
- Commit message:
- EX21
Changed in this revision
diff -r 000000000000 -r eabaa36e66b0 IHM_V2.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IHM_V2.lib Tue May 29 14:14:42 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/teams/NBoard/code/IHM_V2/#ad91067e3f6d
diff -r 000000000000 -r eabaa36e66b0 Nboard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nboard.h Tue May 29 14:14:42 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 000000000000 -r eabaa36e66b0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 29 14:14:42 2018 +0000 @@ -0,0 +1,42 @@ +#include "Nboard.h" +#include "IHM.h" + +IHM ihm; +PwmOut led1(PA_7); +int main() +{ + + int per=1000, position ; + float duty=0.25; + led1.period_ms(per); + led1.write(duty); + position =ihm.JOG_read(); + led0=1; + while(1) { + switch(position) { + case 0x08 : + if(duty<=0.9) { + duty=duty+0.1; + } + break; + case 0x01 : + if(duty>=0.1) { + duty=duty-0.1; + } + break; + case 0x10 : + per=per+500; + break; + case 0x02 : + per=per-500; + break; + + + + } + led1.period_ms(per); + led1.write(duty); + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("%f %hd ",duty,per); + } +}
diff -r 000000000000 -r eabaa36e66b0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 29 14:14:42 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file