MOVIMIENTO DE LEDS

 

 

Dim contador As Integer

Dim funciona As Boolean

Private Sub Command1_Click()

If funciona Then

funciona = False

Command1.Caption = "Empezar"

Else

funciona = True

Command1.Caption = "Parar"

End If

End Sub

 

Private Sub Form_Load()

HScroll1.Value = 1

contador = HScroll1.Value

Timer1.Interval = 1

Timer1.Enabled = True

funciona = False

End Sub

Private Sub lucir(index As Integer)

Dim i, r As Integer

r = index

For i = 0 To 6

Shape1(i).BackColor = vbRed

Next i

Shape1(r).BackColor = vbYellow

End Sub

 

Private Sub HScroll1_Change()

Label1.Caption = "velocidad = " & HScroll1.Value

Timer1.Interval = HScroll1.Value

End Sub

 

Private Sub Timer1_Timer()

If funciona Then

contador = contador + 1

If contador > 6 Then contador = 0

lucir (contador)

End If

End Sub