Joseph Bradshaw
/
mbed_LED_tester
Used to test the I/O of the mbed module to drive LED's
Revision 0:2890747e59eb, committed 2016-01-12
- Comitter:
- jebradshaw
- Date:
- Tue Jan 12 14:21:43 2016 +0000
- Commit message:
- mbed LED I/O output tester
Changed in this revision
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
mbed_LED_tester.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 2890747e59eb mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jan 12 14:21:43 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf \ No newline at end of file
diff -r 000000000000 -r 2890747e59eb mbed_LED_tester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed_LED_tester.cpp Tue Jan 12 14:21:43 2016 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +//makes all pins outputs for LEDs and toggles them +BusOut lowPins(p5,p6,p7,p8, + p9,p10,p11,p12, + p13,p14,p15,p16, + p17,p18,p19,p20); +BusOut highPins(p21,p22,p23,p24, + p25,p26,p27,p28, + p29,p30); + +int main() { + lowPins=0; + highPins=0; + + while(1) { + + for(int i=0;i<5;i++){ + lowPins.write(0xffff); + highPins.write(0xffff); + wait(.3); + lowPins.write(0); + highPins.write(0); + wait(.3); + } + + float delay=.01; + for(int cycles=0;cycles<7;cycles++,delay+=.01){ + for(long i=1;i<0x10000;i<<=1){ + lowPins.write(i); + wait(delay); + } + lowPins=0; + for(int i=1;i<0x0400;i<<=1){ + highPins.write(i); + wait(delay); + } + highPins=0; + wait(delay); + } + } +}