Led Classs lauflicht

Dependencies:   mbed

Committer:
PDanner
Date:
Thu Nov 15 18:08:47 2018 +0000
Revision:
0:56c788099a36
Led Class Lauflicht

Who changed what in which revision?

UserRevisionLine numberNew contents of line
PDanner 0:56c788099a36 1 #include "mbed.h"
PDanner 0:56c788099a36 2 #include "lauflicht.h"
PDanner 0:56c788099a36 3
PDanner 0:56c788099a36 4 // Instanziierung mit:
PDanner 0:56c788099a36 5 FourLeds fourleds(LED1, LED2, LED3, LED4);
PDanner 0:56c788099a36 6
PDanner 0:56c788099a36 7 // Aufruf der Methoden
PDanner 0:56c788099a36 8 int main() {
PDanner 0:56c788099a36 9 while(1){
PDanner 0:56c788099a36 10 fourleds.lauflichtbalken();
PDanner 0:56c788099a36 11 }
PDanner 0:56c788099a36 12 }
PDanner 0:56c788099a36 13
PDanner 0:56c788099a36 14 void FourLeds::lauflicht(void){
PDanner 0:56c788099a36 15 /*********************************
PDanner 0:56c788099a36 16 D1 D2 D3 D4
PDanner 0:56c788099a36 17 - - - - Ein Durchgang dauert 2 sec
PDanner 0:56c788099a36 18 X - - -
PDanner 0:56c788099a36 19 - X - -
PDanner 0:56c788099a36 20 - - X -
PDanner 0:56c788099a36 21 - - - X
PDanner 0:56c788099a36 22 - - - - X=ON - = off
PDanner 0:56c788099a36 23 *********************************/
PDanner 0:56c788099a36 24 _leds = 0; wait(2);
PDanner 0:56c788099a36 25 _leds = 1; wait(2);
PDanner 0:56c788099a36 26 _leds = 2; wait(2);
PDanner 0:56c788099a36 27 _leds = 4; wait(2);
PDanner 0:56c788099a36 28 _leds = 8; wait(2);
PDanner 0:56c788099a36 29 _leds = 0; wait(2);
PDanner 0:56c788099a36 30 }
PDanner 0:56c788099a36 31 void FourLeds::lauflichtbalken(void){;
PDanner 0:56c788099a36 32 /*********************************
PDanner 0:56c788099a36 33 D1 D2 D3 D4
PDanner 0:56c788099a36 34 - - - - Ein Durchgang dauert 2 sec
PDanner 0:56c788099a36 35 X - - -
PDanner 0:56c788099a36 36 X X - -
PDanner 0:56c788099a36 37 X X X -
PDanner 0:56c788099a36 38 X X X X
PDanner 0:56c788099a36 39 - - - -
PDanner 0:56c788099a36 40 X X X X X=ON - = off
PDanner 0:56c788099a36 41 **********************************/
PDanner 0:56c788099a36 42 _leds = 0; wait(2);
PDanner 0:56c788099a36 43 _leds = 1; wait(2);
PDanner 0:56c788099a36 44 _leds = 3; wait(2);
PDanner 0:56c788099a36 45 _leds = 7; wait(2);
PDanner 0:56c788099a36 46 _leds = 15; wait(2);
PDanner 0:56c788099a36 47 _leds = 0; wait(2);
PDanner 0:56c788099a36 48 _leds = 15; wait(2);
PDanner 0:56c788099a36 49 }