Used to test the I/O of the mbed module to drive LED's

Dependencies:   mbed

mbed_LED_tester.cpp

Committer:
jebradshaw
Date:
2016-01-12
Revision:
0:2890747e59eb

File content as of revision 0:2890747e59eb:

#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);
        }        
    }
}