
Zitat von
Malte0815
Hab jetzt vieles Probiert aber ich komm beim nächsten Tastendruck aus der Sub-routine nicht mehr raus?
Noch ne blöde Frage? Wollte mein "Kunstwerk" mal präsentieren, weiß aber nicht wie ich ein Bild hochladen kann?[/img]
Wenn dein Taster gedrückt wird ist Pinb.3 eher = 1 oder?
ich meinte eher sowas:
Code:
$regfile = "ATtiny13.dat"
$crystal = 4000000
'$hwstack = 32
'$swstack = 5
'$framesize = 20
Config Timer0 = Pwm , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 8
Config Portb.0 = Output
Config Portb.1 = Output
Config Portb.2 = Output
Config Portb.4 = Output
Config Portb.3 = Input
Portb.3 = 1
Portb.2 = 1
Portb.4 = 1
Dim A As Byte
Declare Sub Stop_pwm
Do
For A = 0 To 255 Step 2
Pwm0a = A
Waitms 15
If Pinb.3 = 1 Then
bitwait Pinb.3, reset
Gosub Stop_pwm
End If
Next
For A = 255 To 0 Step -1
Pwm0a = A
Waitms 5
If Pinb.3 = 1 Then
bitwait Pinb.3, reset
Gosub Stop_pwm
End If
Next
For A = 0 To 255 Step 2
Pwm0b = A
Waitms 15
If Pinb.3 = 1 Then
bitwait Pinb.3, reset
Gosub Stop_pwm
End If
Next
For A = 255 To 0 Step -1
Pwm0b = A
Waitms 5
If Pinb.3 = 1 Then
bitwait Pinb.3, reset
Gosub Stop_pwm
End If
Next
Loop
End
Stop_pwm:
Do
If Pinb.3 = 1 then
bitwait Pinb.3, reset ' warten bis er losgelassen wird,
Return 'sonst geht er oben gleich wieder in Stop_pwm
End if
Loop
bei dem bitwait muss man gucken wo es am sinnvollsten ist, ich hab es dir einfach mal so reingesetzt
Bild hochladen: Attachment hinzufügen
Lesezeichen