A slightly more advanced blinky demo
Dependencies: mbed
Revision 0:e71f2de5726c, committed 2014-06-13
- Comitter:
- ethanharstad
- Date:
- Fri Jun 13 18:58:36 2014 +0000
- Commit message:
- Initial commit
Changed in this revision
BetterBlink.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 e71f2de5726c BetterBlink.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BetterBlink.cpp Fri Jun 13 18:58:36 2014 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +DigitalOut out(LED1); +DigitalIn in(USER_BUTTON); + +int divisor = 1; + +int main() { + while(true) { + if(in == false) { + divisor *= 2; + if(divisor >= 16) divisor = 1; + } + out = 1; + wait_ms(500 / divisor); + out = 0; + wait_ms(500 / divisor); + } +} \ No newline at end of file
diff -r 000000000000 -r e71f2de5726c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 13 18:58:36 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721 \ No newline at end of file