test out

Dependencies:   mbed

main.cpp

Committer:
nielsen8
Date:
2010-11-02
Revision:
1:cff3bd30f354
Parent:
0:00e1ad478627

File content as of revision 1:cff3bd30f354:

/** 
    @file doc.h
*/
#include "mbed.h"
/** a blink class 
*
*   gettting the lay of the land
*/
class BLINK{
    public:
    BLINK(PinName pin) : _pin(pin) {  // _pin(pin) means pass pin to the DigitalOut constructor
        _pin = LED2;                                        // default the output to LED2
    }
       /** let flash the led
        @pram n number of time to flash the led
       */
       void flash(int n) {
        for(int i=0; i<n*2; i++) {
            _pin = !_pin;
            wait(0.2);
        }
    }

private:
    DigitalOut _pin;



};


DigitalOut myled(LED1);
BLINK test(LED4);
BLINK test2(LED3);
int main() {
    int i=0;
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
        test.flash(5);
        test2.flash(2);
         printf("Hello World![%i]\r\n",i++);
    }
}