Conta da 0 a 15 in binario
Dependencies: mbed
Revision 0:64b05e7cbcf0, committed 2016-02-28
- Comitter:
- pil310
- Date:
- Sun Feb 28 21:14:42 2016 +0000
- Commit message:
- Conteggio binario da 0 a 15
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 28 21:14:42 2016 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); + + +int main() +{ + + for(int x=0; x<16; x++) { + if (x & 0x1) + myled1 = 1; + else + myled1 = 0; + if (x & 0x2) + myled2 = 1; + else + myled2 = 0; + if (x & 0x4) + myled3 = 1; + else + myled3 = 0; + if (x & 0x8) + myled4 = 1; + else + myled4 = 0; + + wait(0.5); + + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 28 21:14:42 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3 \ No newline at end of file