예제 #1
0
 private void fetchCom()
 {
     String[] ports = System.IO.Ports.SerialPort.GetPortNames();
     foreach (String port in ports)
     {
         comboBox1.Items.Add(port);
     }
     if (ports.Length < 1)
     {
         comboBox1.Items.Add("No ports available");
     }
     comboBox1.SelectedItem = ports[0];
     ArduinoClass.makePort(comboBox1.SelectedItem.ToString());
     StartButton.Visible = true;
 }
예제 #2
0
        private void gotoBeginScreen()
        {
            ArduinoClass ac = new ArduinoClass();

            this.Refresh();
            this.Show();
            this.Refresh();
            System.Threading.Thread.Sleep(5000);
            ac.closePort("COM6");                   //CLOSE PORT
            for (int i = Application.OpenForms.Count - 1; i >= 0; i--)
            {
                //if (Application.OpenForms[i].Name != "DankU")
                Application.OpenForms[i].Close();
            }
            new Beginscherm().Show();
            Thread.Sleep(1);
            this.Close();
        }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (ArduinoClass.makePort(comboBox1.SelectedItem.ToString()) == true)
         {
             StatusText.ForeColor = Color.Green;
             StatusText.Text      = "ARDUINO CONNECTED";
             StartButton.Visible  = true;
         }
         else
         {
             StatusText.ForeColor = Color.Red;
             StatusText.Text      = "NO CONNECTION";
         }
     }
     catch (Exception)
     {
         Error.show("No port selected", "Error");
     }
 }
예제 #4
0
 private void label6_Click(object sender, EventArgs e)
 {
     label6.Text = ArduinoClass.strInput();
 }
예제 #5
0
        private void Extraladen()
        {
            ArduinoClass bootup = new ArduinoClass();

            if (!config)
            {
                bootup.makePort("COM6");
                config = true;
            }

            PinInvoer pinInvoer = new PinInvoer();

            Home        home     = new Home();
            ArduinoData arduino  = new ArduinoData();
            Hash        security = new Hash();
            Executer    executer;
            Boolean     reset = false;
            Boolean     pinCorrect;

            String[] pasInformation;
            bool     EE = true;

            try
            {
                while (true)
                {
                    pinCorrect     = false;
                    pasInformation = new String[4];
                    reset          = false;
                    executer       = null;
                    String   KlantID;
                    String   rekeningID;
                    String   pasID;
                    HTTPget  httpget  = new HTTPget();
                    HTTPpost httppost = new HTTPpost();

                    while (true)
                    {
                        //String emu = ("AAAAAA\n11248649\n1004\n,NEWUID");
                        String s = arduino.getFirstString();
                        if (s.Contains("NEWUID"))
                        {
                            pasInformation = s.Split('\n', '\n', '\n');
                            KlantID        = pasInformation[2];
                            rekeningID     = pasInformation[1];
                            pasID          = pasInformation[0];
                            //Error.show(rekeningID + "," + KlantID + "," + pasID);
                            //Error.show("PasID: " + pasID + "\nRekID: " + rekeningID + "\nKlantID: " + KlantID);
                            pinInvoer.giveInfo(pasInformation);
                            home.giveInfo(pasInformation);
                            //Error.show(KlantID);
                            //Error.show(rekeningID);
                            //Error.show(pasID);

                            executer = new Executer(rekeningID, KlantID, arduino, pasID);

                            break;
                        }
                    }
                    pinInvoer.Show();

                    Thread.Sleep(1);
                    this.Close();
                    break;
                }
            }
            catch (Exception)
            {
                OutOfOrder error = new OutOfOrder();
                error.Show();
                error.Refresh();
                List <Form> openForms = new List <Form>();
                foreach (Form f in Application.OpenForms)
                {
                    openForms.Add(f);
                }
                foreach (Form f in openForms)
                {
                    if (f.Name != "OutOfOrder")
                    {
                        f.Close();
                    }
                }
                while (true)
                {
                }   //Loop forever :)
            }
        }