Junichi Nagayama
/
SIST-5
Manual PWM implementation
Revision 0:4e272b6d58a9, committed 2011-01-22
- Comitter:
- junTMUG
- Date:
- Sat Jan 22 01:03:39 2011 +0000
- Commit message:
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 4e272b6d58a9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 22 01:03:39 2011 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +AnalogIn ain(p20); +DigitalOut myled(p21); + +int main() { + while (1){ + int ledpwm = (int)ain * 256; + int i; + for (i = 0; i < 256; i++){ + if (i < ledpwm) + myled = 1; + else + myled = 0; + + wait_us(100); + } + } +} \ No newline at end of file
diff -r 000000000000 -r 4e272b6d58a9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 22 01:03:39 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e