Jon Trinder
/
nine_ledpatterns
LED Pattern s
main.cpp
- Committer:
- jont
- Date:
- 2016-03-03
- Revision:
- 0:a8f171f6873d
File content as of revision 0:a8f171f6873d:
#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); } }