Académique Documents
Professionnel Documents
Culture Documents
Timer1.Enabled = False
timerrespuesta.Enabled = False
Label1.Text = ""
Labeltiemporesp.Text = ""
NumericUpDownMuestra.Value = 1
NumericUpDownRespuesta.Value = 5
End Sub
Private Sub BotonDelante_Click(sender As Object, e As EventArgs) Handles
BotonDelante.Click
'define intervalos por defecto de los timer
Timer1.Interval = NumericUpDownMuestra.Value * 1000
timerrespuesta.Interval = NumericUpDownRespuesta.Value * 1000
tiempo = 0
tiemporespuesta = 0
'inicia el timer
Timer1.Enabled = True
'pone las variables de bloque (buffer) en cero
bloque1 = 0
bloque2 = 0
bloque3 = 0
bloque4 = 0
'se asegura de que los botones estn visibles al iniciar la prueba
Button1.Visible = True
Button2.Visible = True
Button3.Visible = True
Button4.Visible = True
'Borra los label de resultados por si ya se ejecut antes la prueba
LabelBloque1.Text = "-"
LabelBloque2.Text = "-"
LabelBloque3.Text = "-"
LabelBloque4.Text = "-"
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
'la variable tiempo aumenta y se muestra en label1. Si picturebox1 est visible, lo
invisibiliza y viceversa
'PictureBox1.Visible = Not PictureBox1.Visible
tiempo = tiempo + 1
Label1.Text = tiempo.ToString
'oculta el boton empezar
BotonDelante.Enabled = False
'secuencia 1 (1-2)
If tiempo = 1 Then
Button1.Visible =
End If
If tiempo = 2 Then
Button1.Visible =
End If
If tiempo = 3 Then
Button2.Visible =
End If
If tiempo = 4 Then
Button2.Visible =
False
True
False
True
End If
'fin secuencia 1 (mostrar todos para que el usuario clickee)
If tiempo = 4 Then
Timer1.Enabled = False
timerrespuesta.Enabled = True
End If
'secuencia 2 (2-4-3)
If tiemporespuesta = 1 Then
timerrespuesta.Enabled = False
Labeltiemporesp.Text = "Pausa"
End If
If tiempo = 5 Then
Button2.Visible = False
End If
If tiempo = 6 Then
Button2.Visible = True
End If
If tiempo = 7 Then
Button4.Visible = False
End If
If tiempo = 8 Then
Button4.Visible = True
End If
If tiempo = 9 Then
Button3.Visible = False
End If
If tiempo = 10 Then
Button3.Visible = True
End If
'fin secuencia 2 (mostrar todos para que el usuario clickee)
If tiempo = 10 Then
Timer1.Enabled = False
timerrespuesta.Enabled = True
End If
'secuencia 3 (3-4-2-1)
If tiemporespuesta = 2 Then
timerrespuesta.Enabled = False
Labeltiemporesp.Text = "Pausa"
End If
If tiempo = 11 Then
Button3.Visible = False
End If
If tiempo = 12 Then
Button3.Visible = True
End If
If tiempo = 13 Then
Button4.Visible = False
End If
If tiempo = 14 Then
Button4.Visible = True
End If
If tiempo = 15 Then
Button2.Visible = False
End If
If tiempo = 16 Then
Button2.Visible = True
End If
If tiempo = 17 Then
Button1.Visible = False
End If
If tiempo = 18 Then
Button1.Visible = True
End If
'fin secuencia 3 (mostrar todos para que el usuario clickee)
If tiempo = 18 Then
Timer1.Enabled = False
timerrespuesta.Enabled = True
End If
'secuencia 4 (1-4-2-3-4)
If tiemporespuesta = 3 Then
timerrespuesta.Enabled = False
Labeltiemporesp.Text = "Pausa"
End If
If tiempo = 19 Then
Button1.Visible = False
End If
If tiempo = 20 Then
Button1.Visible = True
End If
If tiempo = 21 Then
Button4.Visible = False
End If
If tiempo = 22 Then
Button4.Visible = True
End If
If tiempo = 23 Then
Button2.Visible = False
End If
If tiempo = 24 Then
Button2.Visible = True
End If
If tiempo = 25 Then
Button3.Visible = False
End If
If tiempo = 26 Then
Button3.Visible = True
End If
If tiempo = 27 Then
Button4.Visible = False
End If
If tiempo = 28 Then
Button4.Visible = True
End If
'fin secuencia 4 (mostrar todos para que el usuario clickee)
If tiempo = 28 Then
Timer1.Enabled = False
timerrespuesta.Enabled = True
End If
End Sub
'Controla el timer del tiempo de respuesta y las variables asociadas
Button1.BackColor
Button2.BackColor
Button3.BackColor
Button4.BackColor
End If
=
=
=
=
ColorDialog1.Color
ColorDialog1.Color
ColorDialog1.Color
ColorDialog1.Color
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'suma1 a cada variable de bloque si el botn1 es parte de la respuesta
If tiemporespuesta >= 0 And tiemporespuesta <= 1 And bloque1 = 0 Then
bloque1 = bloque1 + 1
End If
If tiemporespuesta >= 2 And tiemporespuesta <= 3 And bloque3 = 3 Then
bloque3 = bloque3 + 1
End If
If tiemporespuesta >= 3 And tiemporespuesta <= 4 Then
bloque4 = bloque4 + 1
End If
'Muestra el buffer en los label de resultados
LabelBloque1.Text = bloque1.ToString
LabelBloque2.Text = bloque2.ToString
LabelBloque3.Text = bloque3.ToString
LabelBloque4.Text = bloque4.ToString
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If tiemporespuesta >= 0 And tiemporespuesta <= 1 And bloque1 = 1 Then
bloque1 = bloque1 + 1
End If
If tiemporespuesta >= 1 And tiemporespuesta <= 2 And bloque2 = 0 Then
bloque2 = bloque2 + 1
End If
If tiemporespuesta >= 2 And tiemporespuesta <= 3 And bloque3 = 2 Then
bloque3 = bloque3 + 1
End If
If tiemporespuesta >= 3 And tiemporespuesta <= 4 And bloque4 = 2 Then
bloque4 = bloque4 + 1
End If
'Muestra el buffer en los label de resultados
LabelBloque1.Text = bloque1.ToString
LabelBloque2.Text = bloque2.ToString
LabelBloque3.Text = bloque3.ToString
LabelBloque4.Text = bloque4.ToString
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If tiemporespuesta >= 1 And tiemporespuesta <= 2 And bloque2 = 2 Then
bloque2 = bloque2 + 1
End If
If tiemporespuesta >= 2 And tiemporespuesta <= 3 And bloque3 = 0 Then
bloque3 = bloque3 + 1
End If
If tiemporespuesta >= 3 And tiemporespuesta <= 4 And bloque4 = 3 Then
bloque4 = bloque4 + 1
End If
'Muestra el buffer en los label de resultados
LabelBloque1.Text = bloque1.ToString
LabelBloque2.Text = bloque2.ToString
LabelBloque3.Text = bloque3.ToString
LabelBloque4.Text = bloque4.ToString
End Sub