コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Arduino.PortName = mainForm.ComboBox1.Text;
            try
            {
                Arduino.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Shovon");
            }
            drugs drug1 = new drugs();

            drug1.hour     = int.Parse(comboBox1.Text);
            drug1.minutes  = int.Parse(comboBox2.Text);
            drug1.meridian = comboBox3.Text;
            drug1.drugName = textBox1.Text;
            drug1.amnount  = int.Parse(comboBox4.Text);
            drug1.drugID   = 1;
            //if(drug1.minutes<10)
            Arduino.WriteLine('"' + drug1.hour.ToString() + ":" + drug1.minutes.ToString() + drug1.meridian + "?" + drug1.drugName + "?" + drug1.amnount.ToString() + "?" + drug1.drugID.ToString());
            //Arduino.WriteLine(drug1.hour.GetType().ToString());
            //else
            //Arduino.WriteLine(drug1.hour + ":" + drug1.minutes + drug1.meridian + "?" + drug1.drugName + "?" + drug1.amnount);
            //MessageBox.Show(drug1.hour + ":" + drug1.minutes + drug1.meridian + " " + textBox1.Text + " " + drug1.amnount + "pcs");
            Arduino.Close();
            this.Close();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Arduino.Open();
            drugs drug1 = new drugs();

            drug1.hour     = int.Parse(comboBox1.Text);
            drug1.minutes  = int.Parse(comboBox2.Text);
            drug1.meridian = comboBox3.Text;
            drug1.drugName = textBox1.Text;
            drug1.amnount  = int.Parse(comboBox4.Text);
            drug1.drugID   = 3;
            Arduino.WriteLine('"' + drug1.hour.ToString() + ":" + drug1.minutes.ToString() + drug1.meridian + "?" + drug1.drugName + "?" + drug1.amnount.ToString() + "?" + drug1.drugID.ToString());
            Arduino.Close();
            this.Close();
        }