Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Function testeo()
- detenertest = 0
- 'izquierda (888) 1
- 'derecha (888) 2
- ' ---------------------------------------------------------------------------
- Out Val(888), Val(1)
- Sleep 50
- Out Val(888), Val(0)
- Sleep 10
- '---------------------------------------------------------------------------
- 'Avanza hasta el sensor derecho
- opt1 = 0
- opt2 = 0
- cont = 0
- co = 1
- Do
- Out Val(888), Val(2)
- 'Sleep 5
- 'Out Val(888), Val(0)
- 'Sleep 10
- opto2 = Inp(889)
- opto3 = opto2 And 64
- If opto3 = 0 Then
- opt1 = 1
- End If
- If (opto3 = 64) And (opt1 = 1) Then
- opt2 = 1
- End If
- If (opt1 = 1) And (opt2 = 1) Then
- opt1 = 0
- opt2 = 0
- cont = cont + 1
- End If
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Loop Until cont >= co
- ' ---------------------------------------------------------------------------
- 'Avanza hasta el sensor izquierdo
- opt1 = 0
- opt2 = 0
- cont = 0
- co = 1
- Do
- Out Val(888), Val(1)
- 'Sleep 10
- 'Out Val(888), Val(0)
- 'Sleep 2
- opto2 = Inp(889)
- opto3 = opto2 And 32
- If opto3 = 0 Then
- opt1 = 1
- End If
- If (opto3 = 32) And (opt1 = 1) Then
- opt2 = 1
- End If
- If (opt1 = 1) And (opt2 = 1) Then
- opt1 = 0
- opt2 = 0
- cont = cont + 1
- End If
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Loop Until cont >= co
- ' ---------------------------------------------------------------------------
- 'Toma la hoja
- Out Val(888), Val(0)
- Sleep 10
- a = 0
- For a = 1 To 200
- Out Val(888), Val(17)
- Sleep 5
- Out Val(888), Val(33)
- Sleep 5
- Out Val(888), Val(9)
- Sleep 5
- Out Val(888), Val(65)
- Sleep 5
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Next a
- Out Val(888), Val(0)
- Sleep 10
- Out Val(888), Val(2)
- Sleep 500
- Out Val(888), Val(0)
- Sleep 10
- Out Val(888), Val(1)
- Sleep 500
- Out Val(888), Val(0)
- Sleep 100
- Out Val(888), Val(2)
- Sleep 10
- Out Val(888), Val(0)
- Sleep 10
- For a = 1 To 80
- Out Val(888), Val(16)
- Sleep 5
- Out Val(888), Val(32)
- Sleep 5
- Out Val(888), Val(8)
- Sleep 5
- Out Val(888), Val(64)
- Sleep 5
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Next a
- Out Val(888), Val(1)
- Sleep 20
- Out Val(888), Val(0)
- Sleep 10
- ' ---------------------------------------------------------------------------
- 'Avanza 80 pasos hacia la derecha y se posiciona para empezar
- cont = 0
- co = 80
- Do
- Out Val(888), Val(2)
- Sleep 5
- Out Val(888), Val(0)
- Sleep 10
- opto2 = Inp(889)
- opto3 = opto2 And 16
- If opto3 = 16 Then
- opt1 = 1
- End If
- If (opto3 = 0) And (opt1 = 1) Then
- opt2 = 1
- End If
- If (opt1 = 1) And (opt2 = 1) Then
- opt1 = 0
- opt2 = 0
- 'Sleep 100
- 'Out Val(888), Val(4)
- 'Sleep 10
- 'Out Val(888), Val(0)
- 'Sleep 100
- cont = cont + 1
- End If
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Loop Until cont >= co
- For vuelta = 1 To 5
- '----------------------------------------------------------------
- 'izquierda (888) 1
- 'derecha (888) 2
- 'avanza hacia la izquierda golpeando 60 veces
- opt1 = 0
- opt2 = 0
- cont = 0
- co = 60
- Do
- Out Val(888), Val(1)
- Sleep 5
- Out Val(888), Val(0)
- Sleep 10
- opto2 = Inp(889)
- opto3 = opto2 And 16
- If opto3 = 16 Then
- opt1 = 1
- End If
- If (opto3 = 0) And (opt1 = 1) Then
- opt2 = 1
- End If
- If (opt1 = 1) And (opt2 = 1) Then
- opt1 = 0
- opt2 = 0
- cont = cont + 1
- '-----
- ' golpea
- Sleep 100
- Out Val(888), Val(4)
- Sleep 10
- Out Val(888), Val(0)
- Sleep 100
- '-----
- End If
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Loop Until cont >= co
- a = 0
- For a = 1 To 5
- Out Val(888), Val(16)
- Sleep 5
- Out Val(888), Val(32)
- Sleep 5
- Out Val(888), Val(8)
- Sleep 5
- Out Val(888), Val(64)
- Sleep 5
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Next a
- Out Val(888), Val(0)
- Sleep 10
- '---------------------------------------------------------------------
- '----------------------------------------------------------------
- 'izquierda (888) 1
- 'derecha (888) 2
- 'avanza hacia la derecha golpeando 60 veces
- opt1 = 0
- opt2 = 0
- cont = 0
- co = 60
- Do
- Out Val(888), Val(2)
- Sleep 5
- Out Val(888), Val(0)
- Sleep 10
- opto2 = Inp(889)
- opto3 = opto2 And 16
- If opto3 = 16 Then
- opt1 = 1
- End If
- If (opto3 = 0) And (opt1 = 1) Then
- opt2 = 1
- End If
- If (opt1 = 1) And (opt2 = 1) Then
- opt1 = 0
- opt2 = 0
- cont = cont + 1
- '-----
- ' golpea
- Sleep 100
- Out Val(888), Val(4)
- Sleep 10
- Out Val(888), Val(0)
- Sleep 100
- '-----
- End If
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Loop Until cont >= co
- a = 0
- For a = 1 To 5
- Out Val(888), Val(16)
- Sleep 5
- Out Val(888), Val(32)
- Sleep 5
- Out Val(888), Val(8)
- Sleep 5
- Out Val(888), Val(64)
- Sleep 5
- DoEvents
- If detenertest = 1 Then
- Call detener_test
- End If
- Next a
- Out Val(888), Val(0)
- Sleep 10
- '---------------------------------------------------------------------
- Next vuelta
- For l = 1 To 200
- Out Val(888), Val(16)
- Sleep 10
- Out Val(888), Val(32)
- Sleep 10
- Out Val(888), Val(8)
- Sleep 10
- Out Val(888), Val(64)
- Sleep 10
- DoEvents
- Next l
- Out Val(888), Val(0)
- Sleep 10
- End Function
- Private Sub Command1_Click()
- detenertest = 1
- End Sub
- Private Sub Form_activate()
- Form4.SetFocus
- Call testeo
- 'Do While bandera = 0
- 'Sleep 100
- 'ProgressBar1.Value = ProgressBar1.Value + 1
- 'If ProgressBar1.Value >= 20 Then ProgressBar1.Value = 0
- 'DoEvents
- ' Loop
- a = MsgBox("El Proceso de testeo se realizo correctamente", vbInformation + vbOKOnly,
- "Informacion")
- Unload Me
- Form1.SetFocus
- End Sub
- Private Function detener_test()
- For l = 1 To 400
- Out Val(888), Val(16)
- Sleep 10
- Out Val(888), Val(32)
- Sleep 10
- Out Val(888), Val(8)
- Sleep 10
- Out Val(888), Val(64)
- Sleep 10
- DoEvents
- Next l
- Out Val(888), Val(0)
- Sleep 10
- End
- Unload Me
- detiene = 0
- Form1.Show
- Form1.Enabled = True
- Form1.SetFocus
- DoEvents
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement