Hallo DieHard,
danke für deinen Vorschlag. War zwar nicht ganz, das was ich suchte, habe aber einen großen Teil deiner Routine verwenden können =D>
Ausserdem habe ich auch vieles aus den ConradSamples übernehmen können.
Der Quelltext ist höchstwahrscheinlich ziemlich unausgereift, unnötig lang und unübersichtlich, aber nach Stunden der Tippselei ist es vollbracht: es funktioniert ! Sind fast ganze 1.5Kbyte
Weiss, dass das reindenken in fremdes Code nicht einfach ist, bin aber trotzdem für Optimierungsvorschläge dankbar. Vor allem muss ich mir angewöhnen, mehr mit UProgrammen zu arbeiten.
Code:
'------Ports---------------------
define Top_LED port[1]
define Power port[2]
define Joy_MicroTaster port[3]
define Front_LED port[5]
define Betrieb_ON port[6]
define Ringcounter byte[1]
define Matchcounter byte[2]
define Code byte[3]
define COUNTER byte[4]
define CountDown byte[5]
define CountDownAus byte[13]
define CountDownZaehler byte[5]
'------Für Effekt 4-------------
define BlinkerZaehler byte[6]
'-----Für NeonLampe-----------
define RAND1 byte[7]
define RAND2 byte[8]
define RAND4 byte[9]
define RAND5 byte[10]
define RAND6 byte[11]
define SCOUNTER byte[12]
'---------------------------------
#NoRun
Front_LED=off:Top_LED=off
#AnfangsLoop
If Betrieb_ON=ON Then Goto Neonlampe
if TIMER=49 then goto RESET
if Joy_MicroTaster then goto AnfangsLoop
SECOND=0
wait Joy_MicroTaster:RINGCOUNTER=RINGCOUNTER+1
looktab AnCode,RINGCOUNTER,CODE
if ((TIMER > 15) and (TIMER<CODE))then goto MATCH
if ((TIMER < 15) and (TIMER>CODE))then goto MATCH
MATCHCOUNTER=0:if ((RINGCOUNTER=3) or (Ringcounter>3)) then RINGCOUNTER=0
GOTO AnfangsLoop
#MATCH
MATCHCOUNTER=MATCHCOUNTER+1
if (RINGCOUNTER=3) and (MATCHCOUNTER=3) then goto OPEN
goto AnfangsLoop
#OPEN
RINGCOUNTER=0:MATCHCOUNTER=0:
Goto PowerOn
#RESET
RINGCOUNTER=0
MATCHCOUNTER=0
goto AnfangsLoop
#PowerON
Power=on:pause 25:Power=off
if Betrieb_ON=off then goto NoRun
Gosub NeonLampe
#MittelLoop
if Betrieb_ON=off then goto NoRun
#Run
if Betrieb_ON=off then goto NoRun
if Joy_MicroTaster then goto Run
SECOND=0
wait Joy_MicroTaster
if (TIMER >15) then goto MachausInit
if ((TIMER < 15) and (TIMER>1))then goto LampensteuerungInit
GOTO MittelLoop
#MachausInit
Second=0
#Machaus
if Timer > 25 then goto MittelLoop
gosub GETCODE
on COUNTER goto Aus_0,Aus_1,Aus_2
goto Machaus
#Aus_0
Counter=0
goto Machaus
#Aus_1
Counter=0
goto Machaus
#Aus_2
Counter=0
CountDownZaehler=10
For CountDownAus=1 to 10
Front_Led=off:Top_Led=off
pause CountDownZaehler
Front_Led=On:Top_Led=On
pause CountDownZaehler
CountDownZaehler=CountDownZaehler-1
Next CountDownAus
Power=on:pause 50:Power=off
Goto NoRun
#LampensteuerungInit
Second=0
#Lampensteuerung
if Timer > 30 then goto MittelLoop
gosub GETCODE
on COUNTER goto PGM0,PGM1,PGM2,PGM3,PGM4
goto Lampensteuerung
'-----------------------------------
#PGM0
Goto Lampensteuerung
#PGM1
Tog Top_LED:Counter=0:Goto MittelLoop
#PGM2
Tog Front_LED:Counter=0:Goto MittelLoop
#PGM3
Counter=0:Goto Lampensteuerung
#PGM4
Counter=0:
Goto FlackerLicht
'----Routine von DieHard----------
'-- GET THE CLICK CODE --
#GETCODE
if Joy_MicroTaster=on then RETURN
COUNTER=1
#WAIT_RELEASE
if Joy_MicroTaster=OFF then goto WAIT_RELEASE
SECOND=0 ' RESET 20ms TIMER
'----- WAIT TIMEOUT OR BUTTON ----
#WAIT_PRESS
if TIMER=20 then RETURN ' TIMEOUT 200ms ?
if Joy_MicroTaster=ON then goto WAIT_PRESS
COUNTER=COUNTER+1:Second=0:goto WAIT_RELEASE
'---------------------------------
'-------- PROGRAMM START --------
#NeonLampe
Top_LED=off:Front_LED=off
Scounter=0
RAND1=RAND:RAND2=RAND:RAND4=RAND:RAND5=RAND:RAND6=RAND
#NeonLoop
'--- GET THE RANDOM VALUES -----
RAND1=RAND:RAND2=RAND:RAND4=RAND:RAND5=RAND:RAND6=RAND
'--- MAKE RANDOM FLICKERING -----
#PERIOD
SCOUNTER=SCOUNTER+1:if SECOND>2 then goto ON1:if SCOUNTER>RAND1 then Front_LED=off
#L2 if SECOND>2 then goto ON2:if SCOUNTER>RAND2 then Top_LED=off
#L4 if SECOND>3 then goto ON4
#L5 if SECOND>4 then goto ON5
#L6 if SECOND>5 then goto ON6
if SCOUNTER<RAND1 then deact Front_LED:if SCOUNTER<RAND2 then deact Top_LED
IF SCOUNTER<>255 then goto PERIOD
goto NeonLoop
'---- SWITCH TO FULL BRIGHTNES ---
#ON1 Front_LED=on:goto L2
#ON2 Top_LED=on:goto L4
#ON4 goto L5
#ON5 goto L6
#ON6
'#ALLON goto ALLON
Goto Mittelloop
#Flackerlicht
Top_LED=off:Front_LED=off
pause 100
#Flackerlicht_1
Top_LED=on
if not Joy_MicroTaster=on then goto Flackerlicht_2
if Betrieb_ON=off then goto NoRun
pause 150
Top_LED=off
Front_Led=on
if not Joy_MicroTaster=on then goto Flackerlicht_2
if Betrieb_ON=off then goto NoRun
pause 150
Front_Led=off
goto Flackerlicht_1
#Flackerlicht_2
wait Joy_MicroTaster
if Betrieb_ON=off then goto NoRun
goto Programm2
#Programm2
Pause 100
Top_LED=off:Front_LED=off
#Programm2_1
Top_LED=on:Front_LED=on:pause 3
if Betrieb_ON=off then goto NoRun
Top_LED=off:Front_LED=off:pause 100
if not Joy_MicroTaster=on then goto Programm2_2
goto Programm2_1
#Programm2_2
wait Joy_MicroTaster
if Betrieb_ON=off then goto NoRun
goto Programm3
#Programm3
if Betrieb_ON=off then goto NoRun
Top_LED=on:Front_LED=on:pause (RAND and &H04)*3+6
if Betrieb_ON=off then goto NoRun
Top_LED=off:Front_LED=off:pause (RAND and &H08)*5+7
if not Joy_MicroTaster=on then goto Programm3_1
if Betrieb_ON=off then goto NoRun
goto Programm3
#Programm3_1
wait Joy_MicroTaster
if Betrieb_ON=off then goto NoRun
goto Programm4
#Programm4
Top_LED=off:Front_LED=off
if Betrieb_ON=off then goto NoRun
pause 100
BlinkerZaehler=50
#Programm4_1
For CountDown=1 to 24
Front_Led=on:Top_Led=on
if Betrieb_ON=off then goto NoRun
if not Joy_MicroTaster=on then goto Programm4_2
pause BlinkerZaehler
Front_Led=Off:Top_Led=Off
if Betrieb_ON=off then goto NoRun
if not Joy_MicroTaster=on then goto Programm4_2
pause BlinkerZaehler
If BlinkerZaehler>11 then BlinkerZaehler=BlinkerZaehler-3 else BlinkerZaehler=BlinkerZaehler-1
Next CountDown
BlinkerZaehler=50
goto Programm4
#Programm4_2
wait Joy_MicroTaster
if Betrieb_ON=off then goto NoRun
goto Mittelloop
Table AnCode 0 50 1 1
TabEnd
Lesezeichen