示例#1
0
 /// <summary>
 /// This function is threaded and just checks to see if the COm port is still connected,
 /// aka, if the arduino is still plugged in after connection has been established
 /// </summary>
 public static void isConnectionAlive()
 {
     while (true)
     {
         if (arduinoport.IsOpen)
         {
             Console.WriteLine("Port is still alive.");
         }
         else
         {
             Console.WriteLine("Comms port is dead");
             GameUtility.pauseMatch();
             GameUtility.makeSpeech("Warning: connection with arduino controller lost! Match Auto-pausing!");
             MessageBox.Show("Lost Connection with Arduino Controller.\n" +
                             "Please ensure the cable is fully plugged in and the arduino is on,\n" +
                             "then reconnect the arduino using the Arduino button.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             break;
         }
         Thread.Sleep(100);
     }
 }
示例#2
0
 /// <summary>
 /// Pauses a match, a paused match can only be resumed or stopped, not restarted
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pauseButton_Click(object sender, EventArgs e)
 {
     Console.WriteLine("pause button pushed");
     GameUtility.pauseMatch();
 }