Jon Trinder
/
nine_ledpatterns
LED Pattern s
Revision 0:a8f171f6873d, committed 2016-03-03
- Comitter:
- jont
- Date:
- Thu Mar 03 14:58:31 2016 +0000
- Commit message:
- first release
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 a8f171f6873d main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 03 14:58:31 2016 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +/* +jont@ninelocks.com +Led Light Chaser for Schools demonstration + +*/ +//replace the next line with the output from the designer program +char pattern[] = { 0x01,0x02,0x04,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x04,0x02,0x01,0x02,0x04,0x05}; + +//group LEDS as a unit +BusOut myleds(LED1, LED2, LED3, LED4); + +//writes bytes to the display +void display_pattern(char *testdata){ + //this finds how many elements in the array + int arraysize = sizeof(pattern)/sizeof(pattern[0]); + for(int idx = 0; idx < arraysize; idx++) { + myleds = testdata[idx]; + wait(0.2); + } +} + +int main() { + while(1) { + display_pattern(pattern); + wait(0.5); + } +}
diff -r 000000000000 -r a8f171f6873d mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 03 14:58:31 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb \ No newline at end of file