
elec350
Fork of elec350 by
Diff: led.cpp
- Revision:
- 0:753cf4c2738f
- Child:
- 7:aa63d1e53be6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.cpp Tue Oct 13 01:10:14 2015 +0000 @@ -0,0 +1,24 @@ +#include "led.h" +#include <vector> + +Led::Led(string name) { + if (name == "red") { + this->pinName = PD_14; + } else if (name == "green") { + this->pinName = PD_12; + } else if (name == "orange") { + this->pinName = PD_13; + } else if (name == "blue") { + this->pinName = PD_15; + } + + this->pin = new DigitalOut(this->pinName); +} + +void Led::SwitchOn() { + this->pin->write(1); +} + +void Led::SwitchOff() { + this->pin->write(0); +} \ No newline at end of file