sub PlayerElection()
Dim Finished as Boolean
Finished = false
LEDPlayer1 = off
LEDPlayer2 = off
LEDPlayer3 = off
LEDPlayer4 = off
LEDPlayer5 = off
LEDPlayer6 = off
LEDPlayer7 = off
LEDPlayer8 = off
LEDPlayer9 = off
LEDPlayer10 = off
ElectedPlayer1 = false
ElectedPlayer2 = false
ElectedPlayer3 = false
ElectedPlayer4 = false
ElectedPlayer5 = false
ElectedPlayer6 = false
ElectedPlayer7 = false
ElectedPlayer8 = false
ElectedPlayer9 = false
ElectedPlayer10 = false
While Finished = false
If SwitchPlayer1 = pressed then
LEDPlayer1 = on
ElectedPlayer1 = true
End If
If SwitchPlayer2 = pressed then
LEDPlayer2 = on
ElectedPlayer2 = true
End If
If SwitchPlayer3 = pressed then
LEDPlayer3 = on
ElectedPlayer3 = true
End If
If SwitchPlayer4 = pressed then
LEDPlayer4 = on
ElectedPlayer4 = true
End If
If SwitchPlayer5 = pressed then
LEDPlayer5 = on
ElectedPlayer5 = true
End If
If SwitchPlayer6 = pressed then
LEDPlayer6 = on
ElectedPlayer6 = true
End If
If SwitchPlayer7 = pressed then
LEDPlayer7 = on
ElectedPlayer7 = true
End If
If SwitchPlayer8 = pressed then
LEDPlayer8 = on
ElectedPlayer8 = true
End If
If SwitchPlayer9 = pressed then
LEDPlayer9 = on
ElectedPlayer9 = true
End If
If SwitchPlayer10 = pressed then
LEDPlayer10 = on
ElectedPlayer10 = true
End If
If SwitchFinished = pressed then
Finished = true
End If
Wend 'Finished switch has been pressed. Exit loop
'turn out the lights and go away
LEDPlayer1 = off
LEDPlayer2 = off
LEDPlayer3 = off
LEDPlayer4 = off
LEDPlayer5 = off
LEDPlayer6 = off
LEDPlayer7 = off
LEDPlayer8 = off
LEDPlayer9 = off
LEDPlayer10 = off
End Sub