'************************************************************************** '* Name : Treppenbeleuchtung '* Funktion 1 : Sensor unten/S1 (Beleuchtung startet von unten nach oben/Beleuchtung geht von der Mitte nach oben und unten aus) '* Funktion 2 : Sensor oben /S2 (Beleuchtung startet von oben nach unten/Beleuchtung geht von der Mitte nach oben und unten aus) '* Hinweis 1 : LED1 = LED der Stufe 1 (unten) '* Hinweis 2 : LED12= LED der Stufe 12 (oben) '* Pause : 100ms '* Hardware : Atmega8 '************************************************************************** '* Compiler : lunaAVR 2013.r4 (or newer) '************************************************************************** '* Autor : David '* Datum/Version: 06.06.2016/1.1 '************************************************************************** avr.device = atmega8 avr.clock = 1000000 avr.stack = 64 #define LED1 as PORTD.0 #define LED2 as PORTD.1 #define LED3 as PORTD.2 #define LED4 as PORTD.3 #define LED5 as PORTB.6 #define LED6 as PORTD.5 #define LED7 as PORTD.6 #define LED8 as PORTD.7 #define LED9 as PORTC.0 #define LED10 as PORTC.1 #define LED11 as PORTC.2 #define LED12 as PORTC.3 #define S1 as PortC.4 #define S2 as PortC.5 LED1.mode =output LED2.mode =output LED3.mode =output LED4.mode =output LED5.mode =output LED6.mode =output LED7.mode =output LED8.mode =output LED9.mode =output LED10.mode =output LED11.mode =output LED12.mode =output S1.mode =input,pullup S2.mode =input,pullup do if S1=1 and S2=0 then LED1=1 Waitms 100 LED2=1 Waitms 100 LED3=1 Waitms 100 LED4=1 Waitms 100 LED5=1 Waitms 100 LED6=1 Waitms 100 LED7=1 Waitms 100 LED8=1 Waitms 100 LED9=1 Waitms 100 LED10=1 Waitms 100 LED11=1 Waitms 100 LED12=1 elseif S2=1 and S1=0 then LED12=1 Waitms 100 LED11=1 Waitms 100 LED10=1 Waitms 100 LED9=1 Waitms 100 LED8=1 Waitms 100 LED7=1 Waitms 100 LED6=1 Waitms 100 LED5=1 Waitms 100 LED4=1 Waitms 100 LED3=1 Waitms 100 LED2=1 Waitms 100 LED1=1 elseif S1=0 and S2=0 then LED6=0 and LED7=0 Waitms 100 LED5=0 and LED8=0 Waitms 100 LED4=0 and LED9=0 Waitms 100 LED3=0 and LED10=0 Waitms 100 LED2=0 and LED11=0 Waitms 100 LED1=0 and LED12=0 endif loop