Philipp Danner
/
mbed_TINF_lauflicht
Led Classs lauflicht
Revision 0:56c788099a36, committed 2018-11-15
- Comitter:
- PDanner
- Date:
- Thu Nov 15 18:08:47 2018 +0000
- Commit message:
- Led Class Lauflicht
Changed in this revision
diff -r 000000000000 -r 56c788099a36 lauflicht.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lauflicht.cpp Thu Nov 15 18:08:47 2018 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "lauflicht.h" + +// Instanziierung mit: +FourLeds fourleds(LED1, LED2, LED3, LED4); + +// Aufruf der Methoden +int main() { + while(1){ + fourleds.lauflichtbalken(); + } +} + +void FourLeds::lauflicht(void){ +/********************************* + D1 D2 D3 D4 + - - - - Ein Durchgang dauert 2 sec + X - - - + - X - - + - - X - + - - - X + - - - - X=ON - = off +*********************************/ +_leds = 0; wait(2); +_leds = 1; wait(2); +_leds = 2; wait(2); +_leds = 4; wait(2); +_leds = 8; wait(2); +_leds = 0; wait(2); +} +void FourLeds::lauflichtbalken(void){; +/********************************* + D1 D2 D3 D4 + - - - - Ein Durchgang dauert 2 sec + X - - - + X X - - + X X X - + X X X X + - - - - + X X X X X=ON - = off +**********************************/ +_leds = 0; wait(2); +_leds = 1; wait(2); +_leds = 3; wait(2); +_leds = 7; wait(2); +_leds = 15; wait(2); +_leds = 0; wait(2); +_leds = 15; wait(2); +} \ No newline at end of file
diff -r 000000000000 -r 56c788099a36 lauflicht.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lauflicht.h Thu Nov 15 18:08:47 2018 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" +#ifndef lauflicht_H +#define lauflicht_H + +class FourLeds{ +public: + FourLeds(PinName LED1, PinName LED2, PinName LED3, PinName LED4) : _leds(LED1, LED2, LED3, LED4) + { + _leds = 0; + } + + void lauflicht(void); + void lauflichtbalken(void); + +private: + BusOut _leds; + +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 56c788099a36 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 15 18:08:47 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file