satbir panesar
/
elec350
my library for elec350
Led.cpp@1:8cd3ad6ab5f3, 2016-10-06 (annotated)
- Committer:
- spanesar
- Date:
- Thu Oct 06 09:40:57 2016 +0000
- Revision:
- 1:8cd3ad6ab5f3
added Led classes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spanesar | 1:8cd3ad6ab5f3 | 1 | #include "Led.h" |
spanesar | 1:8cd3ad6ab5f3 | 2 | |
spanesar | 1:8cd3ad6ab5f3 | 3 | Led::Led(PinName pinName): |
spanesar | 1:8cd3ad6ab5f3 | 4 | pin(pinName) |
spanesar | 1:8cd3ad6ab5f3 | 5 | { |
spanesar | 1:8cd3ad6ab5f3 | 6 | } |
spanesar | 1:8cd3ad6ab5f3 | 7 | void Led::switchOn(){ |
spanesar | 1:8cd3ad6ab5f3 | 8 | this->pin = 1; |
spanesar | 1:8cd3ad6ab5f3 | 9 | } |
spanesar | 1:8cd3ad6ab5f3 | 10 | void Led::switchOff(){ |
spanesar | 1:8cd3ad6ab5f3 | 11 | this->pin = 0; |
spanesar | 1:8cd3ad6ab5f3 | 12 | } |
spanesar | 1:8cd3ad6ab5f3 | 13 | void Led::flash(float time){ |
spanesar | 1:8cd3ad6ab5f3 | 14 | this->pin = 1; |
spanesar | 1:8cd3ad6ab5f3 | 15 | wait(time); |
spanesar | 1:8cd3ad6ab5f3 | 16 | this->pin = 0; |
spanesar | 1:8cd3ad6ab5f3 | 17 | } |