Abgabe PE
Dependents: TINF_mbedSimulator_2Leds
2Leds.h@0:a68f8dc747e7, 2018-06-18 (annotated)
- Committer:
- martwerl
- Date:
- Mon Jun 18 17:44:55 2018 +0000
- Revision:
- 0:a68f8dc747e7
- Child:
- 1:980633ae6573
Abgabe PE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
martwerl | 0:a68f8dc747e7 | 1 | #include "mbed.h" |
martwerl | 0:a68f8dc747e7 | 2 | #ifndef TWOLEDS_H |
martwerl | 0:a68f8dc747e7 | 3 | #define TWOLEDS_H |
martwerl | 0:a68f8dc747e7 | 4 | |
martwerl | 0:a68f8dc747e7 | 5 | class TwoLeds |
martwerl | 0:a68f8dc747e7 | 6 | { |
martwerl | 0:a68f8dc747e7 | 7 | public: |
martwerl | 0:a68f8dc747e7 | 8 | TwoLeds(PinName pin1, PinName pin2) : _pin1(pin1), _pin2(pin2) // Initialisierungsliste |
martwerl | 0:a68f8dc747e7 | 9 | { |
martwerl | 0:a68f8dc747e7 | 10 | _pin1 = 0; |
martwerl | 0:a68f8dc747e7 | 11 | _pin2 = 0; |
martwerl | 0:a68f8dc747e7 | 12 | } |
martwerl | 0:a68f8dc747e7 | 13 | void ledOn(void) { |
martwerl | 0:a68f8dc747e7 | 14 | } |
martwerl | 0:a68f8dc747e7 | 15 | |
martwerl | 0:a68f8dc747e7 | 16 | void ledOff(void) { |
martwerl | 0:a68f8dc747e7 | 17 | } |
martwerl | 0:a68f8dc747e7 | 18 | |
martwerl | 0:a68f8dc747e7 | 19 | void ledX(){ //LEDs blinken alternierend |
martwerl | 0:a68f8dc747e7 | 20 | } |
martwerl | 0:a68f8dc747e7 | 21 | |
martwerl | 0:a68f8dc747e7 | 22 | void printStatus(void) |
martwerl | 0:a68f8dc747e7 | 23 | { |
martwerl | 0:a68f8dc747e7 | 24 | printf("LED1 ist jetzt: %d\n", _pin1.read()); |
martwerl | 0:a68f8dc747e7 | 25 | printf("LED2 ist jetzt: %d\n", _pin2.read()); |
martwerl | 0:a68f8dc747e7 | 26 | } |
martwerl | 0:a68f8dc747e7 | 27 | |
martwerl | 0:a68f8dc747e7 | 28 | private: |
martwerl | 0:a68f8dc747e7 | 29 | DigitalOut _pin1; |
martwerl | 0:a68f8dc747e7 | 30 | DigitalOut _pin2; |
martwerl | 0:a68f8dc747e7 | 31 | |
martwerl | 0:a68f8dc747e7 | 32 | }; |
martwerl | 0:a68f8dc747e7 | 33 | #endif |