A very simple example of a library to flash a DigitalOut, used to demonstrate how to write a library
Flasher.cpp@1:95c61fdf5872, 2010-09-03 (annotated)
- Committer:
- simon
- Date:
- Fri Sep 03 11:16:09 2010 +0000
- Revision:
- 1:95c61fdf5872
- Parent:
- 0:6ae07812d2bb
First version as a library, without documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 1:95c61fdf5872 | 1 | #include "Flasher.h" |
simon | 1:95c61fdf5872 | 2 | #include "mbed.h" |
simon | 1:95c61fdf5872 | 3 | |
simon | 1:95c61fdf5872 | 4 | Flasher::Flasher(PinName pin) : _pin(pin) { |
simon | 1:95c61fdf5872 | 5 | _pin = 0; |
simon | 1:95c61fdf5872 | 6 | } |
simon | 1:95c61fdf5872 | 7 | |
simon | 1:95c61fdf5872 | 8 | void Flasher::flash(int n) { |
simon | 1:95c61fdf5872 | 9 | for(int i=0; i<n*2; n++) { |
simon | 1:95c61fdf5872 | 10 | _pin = !_pin; |
simon | 1:95c61fdf5872 | 11 | wait(0.2); |
simon | 1:95c61fdf5872 | 12 | } |
simon | 1:95c61fdf5872 | 13 | } |