Practice at preparing library https://developer-sjc-cyan-border.mbed.org/cookbook/Writing-a-Library
Flasher.cpp@0:15ab39b909c6, 2018-06-15 (annotated)
- Committer:
- denbigh1974
- Date:
- Fri Jun 15 21:49:46 2018 +0000
- Revision:
- 0:15ab39b909c6
First issue of Flasher library (test)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
denbigh1974 | 0:15ab39b909c6 | 1 | #include "Flasher.h" |
denbigh1974 | 0:15ab39b909c6 | 2 | #include "mbed.h" |
denbigh1974 | 0:15ab39b909c6 | 3 | |
denbigh1974 | 0:15ab39b909c6 | 4 | Flasher::Flasher(PinName pin) : _pin(pin) { |
denbigh1974 | 0:15ab39b909c6 | 5 | _pin = 0; |
denbigh1974 | 0:15ab39b909c6 | 6 | } |
denbigh1974 | 0:15ab39b909c6 | 7 | |
denbigh1974 | 0:15ab39b909c6 | 8 | void Flasher::flash(int n) { |
denbigh1974 | 0:15ab39b909c6 | 9 | for(int i=0; i<n*2; i++) { |
denbigh1974 | 0:15ab39b909c6 | 10 | _pin = !_pin; |
denbigh1974 | 0:15ab39b909c6 | 11 | wait(0.2); |
denbigh1974 | 0:15ab39b909c6 | 12 | } |
denbigh1974 | 0:15ab39b909c6 | 13 | } |