'Ampelschaltung v2.0 $regfile = "attiny13.dat" $crystal = 1200000 Config Timer0 = Timer , Prescale = 1024 Enable Timer0 Enable Interrupts On Timer0 Count 'LED Yellow an PB3 Ledy Alias Portb.3 Config Ledy = Output 'LED Green an PB4 Ledg Alias Portb.4 Config Ledg = Output 'LED Red an PB0 Ledr Alias Portb.0 Config Ledr = Output 'Switch an PB1 Sw Alias Pinb.1 Config Sw = Input Portb.1 = 1 Dim Status As Bit Status = 0 Dim Counts As Integer Counts = 0 Do If Sw = 0 Then Gosub Change End If Select Case Status Case 0 : Gosub Normal Case 1 : Gosub Broken End Select Loop Count: Incr Counts Return Change: Toggle Status Wait 1 Return Normal: If Counts = 0 Then Ledr = 1 If Counts = 15 Then Ledy = 1 If Counts = 22 Then Ledr = 0 Ledy = 0 Ledg = 1 End If If Counts = 50 Then Ledg = 0 Ledy = 1 End If If Counts = 57 Then Ledy = 0 Counts = 0 End If Return Broken: Ledr = 0 Ledg = 0 If Counts = 0 Then Ledy = 1 If Counts = 4 Then Ledy = 0 Counts = 0 End If Return End