A very simple example of a library to flash a DigitalOut, used to demonstrate how to write a library
Fork of Flasher by
Revision 1:95c61fdf5872, committed 2010-09-03
- Comitter:
- simon
- Date:
- Fri Sep 03 11:16:09 2010 +0000
- Parent:
- 0:6ae07812d2bb
- Commit message:
- First version as a library, without documentation
Changed in this revision
diff -r 6ae07812d2bb -r 95c61fdf5872 Flasher.cpp --- a/Flasher.cpp Tue May 18 20:08:32 2010 +0000 +++ b/Flasher.cpp Fri Sep 03 11:16:09 2010 +0000 @@ -1,13 +1,13 @@ -#include "Flasher.h" -#include "mbed.h" - -Flasher::Flasher(PinName pin) : _pin(pin) { - _pin = 0; -} - -void Flasher::flash(int n) { - for(int i=0; i<n*2; n++) { - _pin = !_pin; - wait(0.2); - } -} +#include "Flasher.h" +#include "mbed.h" + +Flasher::Flasher(PinName pin) : _pin(pin) { + _pin = 0; +} + +void Flasher::flash(int n) { + for(int i=0; i<n*2; n++) { + _pin = !_pin; + wait(0.2); + } +}
diff -r 6ae07812d2bb -r 95c61fdf5872 Flasher.h --- a/Flasher.h Tue May 18 20:08:32 2010 +0000 +++ b/Flasher.h Fri Sep 03 11:16:09 2010 +0000 @@ -1,15 +1,15 @@ -#ifndef MBED_FLASHER_H -#define MBED_FLASHER_H - -#include "mbed.h" - -class Flasher { -public: - Flasher(PinName pin); - void flash(int n); - -private: - DigitalOut _pin; -}; - -#endif +#ifndef MBED_FLASHER_H +#define MBED_FLASHER_H + +#include "mbed.h" + +class Flasher { +public: + Flasher(PinName pin); + void flash(int n); + +private: + DigitalOut _pin; +}; + +#endif
diff -r 6ae07812d2bb -r 95c61fdf5872 mbed.bld --- a/mbed.bld Tue May 18 20:08:32 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/e6be4cd80aad