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."); }
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; } }
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; 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)); } }
private void connectButton_Click(object sender, RoutedEventArgs e) { _thinkGearWrapper = new ThinkGearWrapper(); _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged; if (!_thinkGearWrapper.Connect(portsComboBox.SelectedItem.ToString(), 57600, true)) { MessageBox.Show("Could not connect to headset!"); } }
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; }
// Use this for initialization void Start() { thinkGearWrapper = new ThinkGearWrapper(); if (isActivated) { thinkGearWrapper.Connect(comPort, 57600, true); fileWriter = new StreamWriter(TestingVariables.path + TestingVariables.name + ".csv"); } attnLows = medLows = attnSum = medSum = eventCount = 0; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { myThinkGear = new ThinkGearWrapper(); TxSmoke = Content.Load<Texture2D>("smoke"); TxMrPotato = Content.Load<Texture2D>("_SS_PotatoHead"); TxInstantMash = Content.Load<Texture2D>("InstantMash"); TxFloor = Content.Load<Texture2D>("Floor"); PotatoTransform = new List<Texture2D>(); Little_Alien_Alien = new List<Texture2D>(); PotatoTransform.Add(TxMrPotato); PotatoTransform.Add(TxInstantMash); alien = Content.Load<Texture2D>("Aliens"); Little_Alien_Alien.Add(alien); //homescreen homeScreen = Content.Load<Texture2D>("Home_Screen"); homeStart = Content.Load<Texture2D>("Start"); homeInfo = Content.Load<Texture2D>("Info"); homeExit = Content.Load<Texture2D>("Exit"); infoScreen = Content.Load<Texture2D>("infoScreen"); // music music = Content.Load<Song>("music"); // menu selection lastChecked = new TimeSpan(0, 0, 0, 0, 0); myPotato = new MrPotatoHead(PotatoTransform, new Vector2(0, 0),200); alienList.Add(new MrPotatoHead(Little_Alien_Alien, new Vector2(-300 + (TxFloor.Width * 1), 0),100)); alienList.Add(new MrPotatoHead(Little_Alien_Alien, new Vector2(-300 + (TxFloor.Width * 2), 0), 100)); alienList.Add(new MrPotatoHead(Little_Alien_Alien, new Vector2(-300 + (TxFloor.Width * 3), 0), 100)); AnimationList = new List<Animation>(); if (!myThinkGear.Connect("COM3", 57600, true)) { this.Exit(); } myAttention = myThinkGear.ThinkGearState.Attention; base.Initialize(); }