예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello.");

            //initialize the array that data will be read into
            m_data = new float[BUFSIZE];

            // Find the open instance of unity
            unityProc = Process.GetProcessesByName("unity").FirstOrDefault();
            if (unityProc == null)
            {
                Console.WriteLine("Could not find a running instance of Unity.");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Found running instance of Unity.");
            }

            // The object that reads the breathing data (the "sensor box")
            axTTLLive1 = new TTLLiveCtrlLib.TTLLive();

            // Create a timer. The parameter is how many milliseconds between ticks
            timer           = new System.Timers.Timer(200);
            timer.Elapsed  += UseDataValue; // Each timer tick, this method will be called
            timer.AutoReset = true;         // Have the timer fire repeated events (true is the default)

            ConnectDevice();
            Console.WriteLine("Device Connected");

            // Start the timer
            timer.Enabled = true;
            Console.WriteLine("Timer started.");
            Console.WriteLine("Reading data...");

            //continuously read data from the sensor
            while (true)
            {
                ReadDataValue();
            }

            Console.WriteLine("Reading finished");
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello.");

            //initialize the array that data will be read into
            m_data = new float[BUFSIZE];

            // Find the open instance of unity
            unityProc = Process.GetProcessesByName("unity").FirstOrDefault();
            if(unityProc == null)
            {
                Console.WriteLine("Could not find a running instance of Unity.");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Found running instance of Unity.");
            }

            // The object that reads the breathing data (the "sensor box")
            axTTLLive1 = new TTLLiveCtrlLib.TTLLive();

            // Create a timer. The parameter is how many milliseconds between ticks
            timer = new System.Timers.Timer(200);
            timer.Elapsed += UseDataValue; // Each timer tick, this method will be called
            timer.AutoReset = true; // Have the timer fire repeated events (true is the default)

            ConnectDevice();
            Console.WriteLine("Device Connected");

            // Start the timer
            timer.Enabled = true;
            Console.WriteLine("Timer started.");
            Console.WriteLine("Reading data...");

            //continuously read data from the sensor
            while (true)
            {
                ReadDataValue();
            }

            Console.WriteLine("Reading finished");
            Console.ReadKey();
        }