예제 #1
0
        public static void EEGStart()
        {
            Console.WriteLine("===================================================================================");
            Console.WriteLine("Example to get the average band power for a specific channel from the latest epoch.");
            Console.WriteLine("===================================================================================");

            AverageBandPowers p = new AverageBandPowers();

            // create the engine
            engine            = EmoEngine.Instance;
            engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);
            engine.Connect();

            string header  = "Theta, Alpha, Low_beta, High_beta, Gamma";;
            string header2 = "COUNTER, INTERPOLATED, RAW_CQ, AF3, F7, F3, FC5, T7, P7, O1, O2, P8," +
                             "T8, FC6, F4, F8, AF4, GYROX, GYROY, TIMESTAMP, MARKER_HARDWARE, ES_TIMESTAMP, FUNC_ID, FUNC_VALUE, MARKER, SYNC_SIGNAL";

            file.WriteLine(header);
            file.WriteLine("");

            file2.WriteLine(header2);
            file2.WriteLine("");
            //minuteSecond = minute * 60 + second;
            //time = minuteSecond;

            for (int i = 0; i < fig.Length; i++)
            {
                fig[i] = 0;//初始化惯性转量数组
            }
            for (int i = 0; i < Eng.Length; i++)
            {
                Eng[i] = 0;
            }
            for (int i = 0; i < score.Length; i++)
            {
                score[i] = 0;
            }
            while (true)
            {
                engine.ProcessEvents(10);
                if (userID < 0)
                {
                    continue;
                }

                if (Console.KeyAvailable)
                {
                    break;
                }
                p.Run();
                Thread.Sleep(10);
            }

            file.Close();
            file2.Close();
            engine.Disconnect();
        }