Warum fragst du dann auf "<130" ab?
Wenn kein Taster gedrückt ist, soll sich doch gar nichts ändern, oder?
Im Moment wird er mit etwa 50Hz runterzählen, wenn kein Taster gedrückt ist. Dann sind alle LEDs nur schwach an.
Ich würde das dann so machen:
GrußCode:$regfile = "m32def.dat" $crystal = 16000000 Config Adc = Single , Prescaler = Auto Config Portc = Output Portc = 30 'LED 1 ist an PORTC=00011110 Start Adc Dim I As Byte Dim X As Word X = 1 I = 1 Do X = Getadc(7) If X > 0 Then If X < 130 Then 'Taster für runter gedrückt I = I - 1 If I = 255 Then I = 4 'dann hat es einen Überlauf gegeben, I ist Byte, also 0-255 Else 'Taster für rauf gedrückt I = I + 1 If I = 6 Then I = 0 End If Portc = 31 'Alle LEDs aus Portc.i = 0 'LED Nr. i an End If Waitms 20 'das ganze etwa 50 mal pro Sekunde Loop End
Rolf
Lesezeichen