Darron Nielsen
/
test_code
test out
Diff: main.cpp
- Revision:
- 0:00e1ad478627
- Child:
- 1:cff3bd30f354
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 02 23:28:18 2010 +0000 @@ -0,0 +1,43 @@ +#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++); + } +}