Example #1
0
 private void btnTreadmillControl_Click(object sender, EventArgs e)
 {
     if (btnTreadmillControl.Text == "Start Treadmill")
     {
         TreadmillController.SetSerialPortName(comboBoxTreadmillPort.Text);
         TreadmillController.SetSpeed(2.0f);
         btnTreadmillControl.Text = "Stop Treadmill";
     }
     else if (btnTreadmillControl.Text == "Stop Treadmill")
     {
         TreadmillController.SetSpeed(0.0f);
         btnTreadmillControl.Text = "Start Treadmill";
     }
 }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainForm()
        {
            InitializeComponent();
            //name thread (useful for debug)
            Thread.CurrentThread.Name = "Main Form Thread";
            //load camera calibration profile
            MotionCapture.LoadProfile("C:\\Users\\mag501\\Documents\\SVN_WorkingCopy\\Stromohab\\stromohab_08\\OptiTrack_Calibrations\\CalibrationFile_020609.cal");
            //register custom events
            OptitrackCommandParser_Server.camerasStartedEvent += new OptitrackCommandParser_Server.CamerasStartedHandler(commandParser_camerasStartedEvent);
            TCPServer.ServerListeningStartedEvent             += new TCPServer.ServerListeningStartedHandler(TCPServer_ServerListeningStartedEvent);
            TCPServer.ClientConnectionAcceptedEvent           += new TCPServer.ClientConnectionAcceptedHandler(TCPServer_ClientConnectionAcceptedEvent);
            //start listening for incoming connections
            TCPServer tcpServer = new TCPServer();

            //enumerate COM ports
            foreach (string portName in System.IO.Ports.SerialPort.GetPortNames())
            {
                comboBoxTreadmillPort.Items.Add(portName);
            }
            comboBoxTreadmillPort.Text = (string)comboBoxTreadmillPort.Items[comboBoxTreadmillPort.Items.Count - 1];

            TreadmillController.SetSerialPortName(comboBoxTreadmillPort.Text);
        }
Example #3
0
 private void btnConnectToTreadmill_Click(object sender, EventArgs e)
 {
     TreadmillController.SetSerialPortName(comboBoxTreadmillPort.Text);
 }