Sudip Mandal
/
LEDBrightnesscontrol
brightness control of led by PWM Technic
Revision 0:366ff44cdee8, committed 2016-11-03
- Comitter:
- papuxtream
- Date:
- Thu Nov 03 06:50:30 2016 +0000
- Commit message:
- brightness control of led by PWM Technic
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 366ff44cdee8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 03 06:50:30 2016 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +DigitalIn ButtonUp(p5,PullUp); +DigitalIn ButtonDown(p6,PullUp); +PwmOut led(p26); +int val=0; +int main() { + while(1) { + if((ButtonUp==1)&&(val<255)) + {wait_ms(10); + val++;} + else if((ButtonDown==1)&&(val>0)) + {wait_ms(10); + val--;} + val=led; + } +}
diff -r 000000000000 -r 366ff44cdee8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 03 06:50:30 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96 \ No newline at end of file