Ian Phillips
/
BinaryCounter
Revision 0:f8c5197531aa, committed 2009-12-22
- Comitter:
- IanP24
- Date:
- Tue Dec 22 23:05:12 2009 +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 f8c5197531aa main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 22 23:05:12 2009 +0000 @@ -0,0 +1,35 @@ +/*********************************/ +/* Binary Count on the Four LEDs */ +/* With optional Trace to TTY */ +/*********************************/ + +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx +DigitalOut led1(LED1), led2(LED2), led3(LED3), led4(LED4); +int p=0, q=0, r=0, s=0; + + +int main() { + led1=0,led2=0,led3=0,led4=0; + pc.printf("\n\nStart ... %d %d %d %d %s \n", p, q, r, s, "Count"); + + for (int j=0; j<256; j++) { + //wait(0.2); //Slow it down to see it + if (led1==1&&led2==1&&led3==1) { + led1=0; + led2=0; + led3=0; + led4=!led4; + } else if (led1==1&&led2==1) { + led1=0; + led2=0; + led3=!led3; + } else if (led1==1) { + led1=0; + led2=!led2; + } else led1=!led1; + //pc.printf("Now ... %d %d %d %d %d \n", p=led1, q=led2, r=led3, s=led4, j); //turn on TTY Trace (slow) + } +} +
diff -r 000000000000 -r f8c5197531aa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 22 23:05:12 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0