part2
Dependencies: mbed
Revision 0:49b55c5b7bef, committed 2015-03-03
- Comitter:
- jaredwil
- Date:
- Tue Mar 03 19:24:31 2015 +0000
- Commit message:
- part2;
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 49b55c5b7bef main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Mar 03 19:24:31 2015 +0000 @@ -0,0 +1,48 @@ +#include "mbed.h" + +BusIn joy(p15,p12,p13,p16); + +BusOut leds(LED1,LED2,LED3,LED4); + +Serial pc(USBTX, USBRX); + +int main() +{ + int one[4] = {0x1, 0x2, 0x4, 0x8}; + int two[6] = {0x3, 0x5, 0x9, 0x6, 0xA,0xC}; + int three[4] = {0x7, 0xB, 0xE, 0xD}; + srand(time(NULL)); + int a; + while(1) { + leds = 0x0; + + switch(joy) { + case 0x1: + leds = 0xF; + break; + case 0x2: + a = (rand()%4); + leds = three[a]; + while(joy == 0x2){ + //WAIT + } + break; + case 0x4: + a = (rand()%6); + leds = two[a]; + while(joy == 0x4){ + //WAIT + } + break; + case 0x8: + a = (rand()%4); + leds = one[a]; + while(joy == 0x8){ + //WAIT + } + break; + } + + + } +} \ No newline at end of file
diff -r 000000000000 -r 49b55c5b7bef mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Mar 03 19:24:31 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file