Ejemplo n.º 1
0
 private void btnConnectBouncerA_Click(object sender, EventArgs e)
 {
     if (btnConnectBouncerA.Text == "Connect")
     {
         //String port = cbbComPorts.Text.Substring(0,cbbComPorts.Text.IndexOf(' '));
         String port = cbbBouncerAComs.Text;
         if (bouncerAMessenger.Connect(port))
         {
             UpdateButtonsAndConnectionInfo();
             lbLog.Items.Clear();
             messageTimer.Start();
         }
         else
         {
             MessageBox.Show("Failed to connect to serial port '" + port + "'.\n"
                             + "Is your EV3 connected to that serial port? Or is it using another one?");
         }
     }
     else
     {
         //messageReceiveTimer.Stop();
         bouncerAMessenger.Disconnect();
         UpdateButtonsAndConnectionInfo();
     }
 }
Ejemplo n.º 2
0
 public Pong()
 {
     InitializeComponent();
     ev3Messenger = new EV3Messenger();
     jukebox();
     ev3Messenger.Connect("COM3");
 }
Ejemplo n.º 3
0
 public Pong()
 {
     InitializeComponent();
     ev3Messenger1 = new EV3Messenger();
     ev3Messenger2 = new EV3Messenger();
     jukebox();
     ev3Messenger1.Connect("COM3");
     ev3Messenger2.Connect("COM6");
     winner    = 0;
     gamemodep = MainMenu.gamemode;
 }
Ejemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!ev3Messenger.IsConnected)
     {
         ev3Messenger.Connect(comboBox1.Text.ToUpper());
         flowLayoutPanel1.BackColor = Color.Green;
     }
     else
     {
         ev3Messenger.Disconnect();
         flowLayoutPanel1.BackColor = Color.Red;
     }
 }
Ejemplo n.º 5
0
        static void Main()
        {
            ev3Messenger.Connect(EV3_SERIAL_PORT);

            Form form = new StartForm();

            form.ShowDialog();

            /*
             * using (var game = new Run4FunGame())
             *  game.Run();
             */
        }
Ejemplo n.º 6
0
        private void comboComport_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String port = comboComport.SelectedValue.ToString();

            if (ev3Messenger.Connect(port))
            {
                bluetooth = true;
                ReadyToStart();
            }
            else
            {
                butAdd.IsEnabled = false;
                this.ShowMessageAsync("Hmmm.....", "Kon niet connecten met Jack op '" + port + "', zit Jack niet op een andere port? ");
            }
        }
Ejemplo n.º 7
0
        private void connectButton2_Click(object sender, EventArgs e)
        {
            String port2 = serialPortSelectionBox2.Text;

            if (messenger2.Connect(port2))
            {
                UpdateButtonsAndConnectionInfo2();
                receivedMessagesListBox.Items.Clear();
                readTimer.Start();
            }
            else
            {
                MessageBox.Show("Failed to connect to serial port '" + port2 + "'.\n"
                                + "Is your EV3 connected to that serial port? Or is it using another one?");
            }
        }
Ejemplo n.º 8
0
 private void connect_button_Click(object sender, EventArgs e)
 {
     if (comPorts_listbox.SelectedIndex > -1)
     {
         string port = comPorts_listbox.SelectedItem.ToString().ToUpper();
         if (messenger.Connect(port))
         {
             Thread newThread = new Thread(this.StatusChecker);
             newThread.Start();
             updateFormGUI();
         }
         else
         {
             MessageBox.Show("Failed to connect to serial port '" + port + "'\n" + "make sure your robot is connected to that serial port and try again.");
         }
     }
     else
     {
         MessageBox.Show("connect plox");
     }
 }
Ejemplo n.º 9
0
 private void connectBtn_Click(object sender, EventArgs e)
 {
     // Check if a port has been selected
     if (portsListBox.SelectedIndex > -1)
     {
         // Get the selected port from the ListBox
         string port = portsListBox.SelectedItem.ToString().ToUpper();
         // Try to connect with the Brick via the selected port
         if (messenger.Connect(port))
         {
             updateFormGUI();
         }
         else
         {
             MessageBox.Show("Failed to connect to serial port '" + port + "'.\n"
                             + "Make sure your robot is connected to that serial port and try again.");
         }
     }
     else
     {
         MessageBox.Show("Please select a port for the bluetooth connection");
     }
 }
 //EV3 messanger function lib
 public static void Connect(int port)
 {
     messenger.Connect("COM" + port.ToString());
 }