TwoLeds
Revision 0:123f959287de, committed 2018-06-20
- Comitter:
- franzpaulus
- Date:
- Wed Jun 20 16:02:56 2018 +0000
- Commit message:
- Franz TwoLeds
Changed in this revision
TINF_Bsp1_TwoLeds.cpp | Show annotated file Show diff for this revision Revisions of this file |
TINF_Bsp1_TwoLeds.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 123f959287de TINF_Bsp1_TwoLeds.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TINF_Bsp1_TwoLeds.cpp Wed Jun 20 16:02:56 2018 +0000 @@ -0,0 +1,8 @@ +#include "mbed.h" // Beispiel 1 +#include "TINF_Bsp1_TwoLeds.h" + + +void TwoLeds::printStatus(void){ + printf("Blink! LED1 is now %d\n", _pin1.read()); + printf("Blink! LED2 is now %d\n\n", _pin2.read()); + }
diff -r 000000000000 -r 123f959287de TINF_Bsp1_TwoLeds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TINF_Bsp1_TwoLeds.h Wed Jun 20 16:02:56 2018 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" // Beispiel 1 +#ifndef TWOLEDS_H +#define TWOLEDS_H + +class TwoLeds{ +public: + TwoLeds(PinName pin1, PinName pin2) : _pin1(pin1), _pin2(pin2) { // Initialisierungsliste + _pin1 = 0; // Initialisierung mit 0 + _pin2 = 0; + } + void ledon(void){ + _pin1 = 1; + _pin2 = 1; + } + + void ledoff(void){ + _pin1 = 0; + _pin2 = 0; + } + + void ledX(void){ + _pin1 = !_pin1; + _pin2 = !_pin1; + } + + void printStatus(void); + +private: + DigitalOut _pin1; + DigitalOut _pin2; +}; + +#endif