Exemplo n.º 1
0
        //public static void Test3SpaceSensorAccGyro()
        //{
        //    SpaceSensorMain spaceSensorMain = new SpaceSensorMain();
        //    spaceSensorMain.SpaceSensorObject1.Connect();

        //    CSVFileWriter csvFileWriter = new CSVFileWriter(@"D:\temp\TestData.csv");

        //    for (int i = 0; i < 50; i++)
        //    {
        //        SensorData sensorDataObj = spaceSensorMain.SpaceSensorObject1.ReadAccGyroData();
        //        //Quaternion sensor2QuatObj = _spaceSensorMain.SpaceSensorObject2.ReadOrientation();
        //        StringBuilder dataRow = new StringBuilder();

        //        dataRow.Append(String.Format("{0:hh:mm:ss.fff}", DateTime.Now));
        //        dataRow.Append("," + sensorDataObj.AccDataObject.DataVector.X);
        //        dataRow.Append("," + sensorDataObj.AccDataObject.DataVector.Y);
        //        dataRow.Append("," + sensorDataObj.AccDataObject.DataVector.Z);
        //        dataRow.Append("," + sensorDataObj.GyroDataObject.Pitch);
        //        dataRow.Append("," + sensorDataObj.GyroDataObject.Roll);
        //        dataRow.Append("," + sensorDataObj.GyroDataObject.Yaw);

        //        csvFileWriter.writeLine(dataRow.ToString());
        //        Thread.Sleep(100);

        //    }

        //    csvFileWriter.close();
        //}

        public static void Test3SpaceSensor()
        {
            Wiimotes wiimotesObj = Wiimotes.getWiimotesObject();

            wiimotesObj.connectWiimotes(1);
            wiimotesObj.StartDataCollection(@"D:\temp\TestData.csv", true);
            Thread.Sleep(30000);
            wiimotesObj.StopDataCollection();
            Thread.Sleep(3000);
            wiimotesObj.disconnectWiimotes();
            Application.Exit();
        }
        public void disconnectWiimotes()
        {
            try
            {
                m_Wiimotes.disconnectWiimotes();

                this.m_parent.SetTextWiimoteStatus(WIIMOTES_DISCONNECTED_STRING);
                this.m_parent.SetWiimoteButtonState((object)Form1.WiimoteButtonState.DISCONNECTED);
                this.m_parent.wiimoteConnectionProgress.Value = 0;
            }
            catch (WiimoteCommunicationException ex)
            {
                Console.WriteLine(ex);
            }
        }