Joseph Bradshaw
/
mbed_LED_tester
Used to test the I/O of the mbed module to drive LED's
Embed:
(wiki syntax)
Show/hide line numbers
mbed_LED_tester.cpp
00001 #include "mbed.h" 00002 //makes all pins outputs for LEDs and toggles them 00003 BusOut lowPins(p5,p6,p7,p8, 00004 p9,p10,p11,p12, 00005 p13,p14,p15,p16, 00006 p17,p18,p19,p20); 00007 BusOut highPins(p21,p22,p23,p24, 00008 p25,p26,p27,p28, 00009 p29,p30); 00010 00011 int main() { 00012 lowPins=0; 00013 highPins=0; 00014 00015 while(1) { 00016 00017 for(int i=0;i<5;i++){ 00018 lowPins.write(0xffff); 00019 highPins.write(0xffff); 00020 wait(.3); 00021 lowPins.write(0); 00022 highPins.write(0); 00023 wait(.3); 00024 } 00025 00026 float delay=.01; 00027 for(int cycles=0;cycles<7;cycles++,delay+=.01){ 00028 for(long i=1;i<0x10000;i<<=1){ 00029 lowPins.write(i); 00030 wait(delay); 00031 } 00032 lowPins=0; 00033 for(int i=1;i<0x0400;i<<=1){ 00034 highPins.write(i); 00035 wait(delay); 00036 } 00037 highPins=0; 00038 wait(delay); 00039 } 00040 } 00041 }
Generated on Fri Aug 19 2022 00:32:08 by 1.7.2