Esempio n. 1
0
        private static void Main(string[] args)
        {
            ICrazyradioDriver crazyDriver = null;
            ThinkGearWrapper  brain       = null;

            try
            {
                brain = OpenMindWave();
                brain.ThinkGearChanged += BrainChanged;

                crazyDriver = GetCrazyDriver();
                OpenCrazyDriver(crazyDriver);

                MainLoop(crazyDriver);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                CloseCrazyDriver(crazyDriver);
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();
        }
Esempio n. 2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            _thinkGearWrapper = new ThinkGearWrapper();

            // setup the event
            _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;

            // connect to the device on the specified COM port at 57600 baud
            if (!_thinkGearWrapper.Connect(cboPort.SelectedItem.ToString(), 57600, true))
            {
                MessageBox.Show("Could not connect to headset.");
            }
            else
            {
                endText1.Text     = "Game Over!";
                endText2.Text     = "Your final score: " + Inscore;
                gameDesigner.Text = "Game Designed By VFU MindWave team";

                endText1.Visible     = false;
                endText2.Visible     = false;
                gameDesigner.Visible = false;

                gameTimer.Start();
            }
        }
Esempio n. 3
0
        public static Boolean Initialize()
        {
            try
            {
                if (!m_boolInitialized && !m_boolInitError)
                {
                    PortForm formPort = new PortForm();
                    if (formPort.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            _thinkGearWrapper = new ThinkGearWrapper();
                            _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;
                            if (_thinkGearWrapper.Connect(formPort.SelectedPort, 57600, true))
                            {
                                _thinkGearWrapper.EnableBlinkDetection(true);
                                Algorithm = formPort.Algorithm;
                                Threshold = formPort.Threshold;

                                TCMP  = formPort.TCMP;
                                NZT48 = formPort.NZT48;

                                Arduino      = formPort.Arduino;
                                ArduinoPort  = formPort.ArduinoPort;
                                ArduinoDelay = formPort.ArduinoDelay;
                                ArduinoOn    = formPort.ArduinoOn;
                                ArduinoOff   = formPort.ArduinoOff;

                                m_boolInitialized = true;
                            }
                            else
                            {
                                throw new Exception("Could not connect to port " + formPort.SelectedPort + ".");
                            }
                        }
                        catch (Exception ex)
                        {
                            if (!m_boolInitError)
                            {
                                MessageBox.Show(ex.Message, "LucidScribe.InitializePlugin()", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            m_boolInitError = true;
                        }
                    }
                    else
                    {
                        m_boolInitError = true;
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                m_boolInitError = true;
                throw (new Exception("The 'NeuroSky' plugin failed to initialize: " + ex.Message));
            }
        }
Esempio n. 4
0
        public void Connect()
        {
            _thinkGearWrapper = new ThinkGearWrapper();

            // setup the event
            _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;

            // connect to the device on the specified COM port at 57600 baud
            _thinkGearWrapper.Connect("COM5", 57600, true);
        }
Esempio n. 5
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            _thinkGearWrapper = new ThinkGearWrapper();

            // setup the event
            _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;

            // connect to the device on the specified COM port at 57600 baud
            if (!_thinkGearWrapper.Connect(cboPort.SelectedItem.ToString(), 57600, true))
            {
                MessageBox.Show("Could not connect to headset.");
            }
        }
Esempio n. 6
0
        private static ThinkGearWrapper OpenMindWave()
        {
            var brain = new ThinkGearWrapper();

            // hard-coded COM port for the mindwave
            if (!brain.Connect("COM6", 57600, true))
            {
                throw new Exception("Failed to connect to mindwave");
            }

            //brain.EnableBlinkDetection(true);

            return(brain);
        }
Esempio n. 7
0
        private void connectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _thinkGearWrapper = new ThinkGearWrapper();

            // setup the event
            _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;
            label1.Text      = "CONNECTED!";
            label1.ForeColor = Color.Green;
            // connect to the device on the specified COM port at 57600 baud
            if (!_thinkGearWrapper.Connect(cboPort.SelectedItem.ToString(), 57600, true))
            //if (!_thinkGearWrapper.Connect("COM5".ToString(), 57600, true))
            {
                MessageBox.Show("Could not connect to headset.");
                label1.Visible = true;
            }
        }
Esempio n. 8
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            _thinkGearWrapper = new ThinkGearWrapper();

            // setup the event
            _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;

            // connect to the device on the specified COM port at 57600 baud
            if (!_thinkGearWrapper.Connect(cboPort.SelectedItem.ToString(), Convert.ToInt32(cboRate.SelectedItem), true))
            {
                MessageBox.Show("Could not connect to headset.");
            }

            //enable the blink detection
            _thinkGearWrapper.EnableBlinkDetection(true);
        }
 public ThinkGearController()
     : base(IntegrationType.Direct)
 {
     _gearWrapper = new ThinkGearWrapper();
     _gearWrapper.ThinkGearChanged += OnThinkGearChanged;
 }