Hi!

Ich habe die oben gezeigte Schaltung nun aufgebaut und getestet:

Das Ergebnis seht ihr hier.



Derzeit habe ich den Atmega8 wie folgt programmiert:

Code:
$crystal = 3686411
$regfile = "m8def.dat"
Config Portc = Output
Config Portd = Input
Portd = &H0C

Dim Tmp As Byte
Dim Tmp2 As Byte
Tmp = 1
Tmp2 = 1
Do
 If Pind.2 = 0 Then
      Portc.0 = 1
      Portc.1 = 0
      Portc.2 = 1
      Portc.3 = 0
      Waitms 5
      Portc.0 = 1
      Portc.1 = 0
      Portc.2 = 0
      Portc.3 = 1
      Waitms 5
      Portc.0 = 0
      Portc.1 = 1
      Portc.2 = 0
      Portc.3 = 1
      Waitms 5
      Portc.0 = 0
      Portc.1 = 1
      Portc.2 = 1
      Portc.3 = 0
      Waitms 5
 Elseif Pind.3 = 0 Then
      Portc.0 = 0
      Portc.1 = 1
      Portc.2 = 1
      Portc.3 = 0
      Waitms 5
      Portc.0 = 0
      Portc.1 = 1
      Portc.2 = 0
      Portc.3 = 1
      Waitms 5
      Portc.0 = 1
      Portc.1 = 0
      Portc.2 = 0
      Portc.3 = 1
      Waitms 5
      Portc.0 = 1
      Portc.1 = 0
      Portc.2 = 1
      Portc.3 = 0
      Waitms 5
 Else
' keine Taste ist gedrückt LED zurücksetzten
  Tmp = 1
  Tmp2 = 1
  Portc = 0
 End If
Loop
End

Lässt sich dies noch schöner/kürzer machen?

Wie kann ich die Geschwindigkeit, die derzeit per "Waitms 5" geregelt ist anhand eines Potis regeln?

Danke und Gruß
Houdini