コード例 #1
0
ファイル: Program.cs プロジェクト: blaind/flux_iot_emotiv_sdk
        static void Main(string[] args)
        {
            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
            EmoEngine engine = EmoEngine.Instance;

            engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);
            engine.Connect();

            string header = "Theta, Alpha, Low_beta, High_beta, Gamma";;

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

            EdkDll.IEE_DataChannel_t[] channelList = new EdkDll.IEE_DataChannel_t[5] {
                EdkDll.IEE_DataChannel_t.IED_AF3, EdkDll.IEE_DataChannel_t.IED_AF4, EdkDll.IEE_DataChannel_t.IED_T7,
                EdkDll.IEE_DataChannel_t.IED_T8, EdkDll.IEE_DataChannel_t.IED_O1
            };

            while (true)
            {
                engine.ProcessEvents(10);

                if (userID < 0)
                {
                    continue;
                }

                if (Console.KeyAvailable)
                {
                    break;
                }

                double[] alpha     = new double[1];
                double[] low_beta  = new double[1];
                double[] high_beta = new double[1];
                double[] gamma     = new double[1];
                double[] theta     = new double[1];

                for (int i = 0; i < 5; i++)
                {
                    engine.IEE_GetAverageBandPowers((uint)userID, channelList[i], theta, alpha, low_beta, high_beta, gamma);
                    file.Write(theta[0] + ",");
                    file.Write(alpha[0] + ",");
                    file.Write(low_beta[0] + ",");
                    file.Write(high_beta[0] + ",");
                    file.WriteLine(gamma[0] + ",");

                    Console.WriteLine("Theta: " + theta[0]);
                }
            }

            file.Close();
            engine.Disconnect();
        }
コード例 #2
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();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: hailsalex91/community-sdk
        static void Main(string[] args)
        {
            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
            EmoEngine engine = EmoEngine.Instance;
            engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);
            engine.Connect();

            string header = "Theta, Alpha, Low_beta, High_beta, Gamma"; ;
            file.WriteLine(header);
            file.WriteLine("");

            EdkDll.IEE_DataChannel_t[] channelList = new EdkDll.IEE_DataChannel_t[5] { EdkDll.IEE_DataChannel_t.IED_AF3, EdkDll.IEE_DataChannel_t.IED_AF4, EdkDll.IEE_DataChannel_t.IED_T7, 
                                                                                       EdkDll.IEE_DataChannel_t.IED_T8, EdkDll.IEE_DataChannel_t.IED_O1 };

            while (true)
            {
                engine.ProcessEvents(10);

                if (userID < 0) continue;

                if (Console.KeyAvailable)
                    break;
                
                double[] alpha = new double[1];
                double[] low_beta = new double[1];
                double[] high_beta = new double[1];
                double[] gamma = new double[1];
                double[] theta = new double[1];
                
                for(int i = 0 ; i < 5 ; i ++)
                {
                    engine.IEE_GetAverageBandPowers((uint)userID, channelList[i], theta, alpha, low_beta, high_beta, gamma);
                    file.Write(theta[0] + ",");
                    file.Write(alpha[0] + ",");
                    file.Write(low_beta[0] + ",");
                    file.Write(high_beta[0] + ",");
                    file.WriteLine(gamma[0] + ",");

                    Console.WriteLine("Theta: " + theta[0]);
                }
            }

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