Abgabe PE
Dependents: TINF_mbedSimulator_2Leds
Diff: 2Leds.cpp
- Revision:
- 0:a68f8dc747e7
diff -r 000000000000 -r a68f8dc747e7 2Leds.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2Leds.cpp Mon Jun 18 17:44:55 2018 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" +#include "2Leds.h" + +void TwoLeds::ledOn(void) +{ + _pin1 = 1; + + _pin2 = 1; +} + +void TwoLeds::ledOff(void) +{ + _pin1 = 0; + _pin2 = 0; +} + +void TwoLeds::ledX() //LEDs blinken alternierend +{ + + if (_pin1 == 0 && _pin2 == 0) + { + _pin1 = 1; + _pin2 = 0; + } + else if (_pin1 == 1 && _pin2 == 0) + { + _pin1 = 0; + _pin2 = 1; + } + else if (_pin1 == 0 && _pin2 == 1) + { + _pin1 = 1; + _pin2 = 0; + } + +} + +void TwoLeds::printStatus(void) +{ + printf("LED1 ist jetzt: %d\n", _pin1.read()); + printf("LED2 ist jetzt: %d\n", _pin2.read()); +} \ No newline at end of file