
elec350
Fork of elec350 by
led.cpp@7:aa63d1e53be6, 2015-10-20 (annotated)
- Committer:
- rmerrisonhort
- Date:
- Tue Oct 20 14:06:30 2015 +0000
- Revision:
- 7:aa63d1e53be6
- Parent:
- 0:753cf4c2738f
- Child:
- 15:c1362c12a896
Changed Led methods to On and Off.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rmerrisonhort | 0:753cf4c2738f | 1 | #include "led.h" |
rmerrisonhort | 0:753cf4c2738f | 2 | #include <vector> |
rmerrisonhort | 0:753cf4c2738f | 3 | |
rmerrisonhort | 0:753cf4c2738f | 4 | Led::Led(string name) { |
rmerrisonhort | 0:753cf4c2738f | 5 | if (name == "red") { |
rmerrisonhort | 0:753cf4c2738f | 6 | this->pinName = PD_14; |
rmerrisonhort | 0:753cf4c2738f | 7 | } else if (name == "green") { |
rmerrisonhort | 0:753cf4c2738f | 8 | this->pinName = PD_12; |
rmerrisonhort | 0:753cf4c2738f | 9 | } else if (name == "orange") { |
rmerrisonhort | 0:753cf4c2738f | 10 | this->pinName = PD_13; |
rmerrisonhort | 0:753cf4c2738f | 11 | } else if (name == "blue") { |
rmerrisonhort | 0:753cf4c2738f | 12 | this->pinName = PD_15; |
rmerrisonhort | 0:753cf4c2738f | 13 | } |
rmerrisonhort | 0:753cf4c2738f | 14 | |
rmerrisonhort | 0:753cf4c2738f | 15 | this->pin = new DigitalOut(this->pinName); |
rmerrisonhort | 0:753cf4c2738f | 16 | } |
rmerrisonhort | 0:753cf4c2738f | 17 | |
rmerrisonhort | 7:aa63d1e53be6 | 18 | void Led::On() { |
rmerrisonhort | 0:753cf4c2738f | 19 | this->pin->write(1); |
rmerrisonhort | 0:753cf4c2738f | 20 | } |
rmerrisonhort | 0:753cf4c2738f | 21 | |
rmerrisonhort | 7:aa63d1e53be6 | 22 | void Led::Off() { |
rmerrisonhort | 0:753cf4c2738f | 23 | this->pin->write(0); |
rmerrisonhort | 0:753cf4c2738f | 24 | } |