Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            openPort();

            if (textBox1.Text.Length <= 0)
            {
                textBox1.Text = "0";
            }

            int fromTxtBox = Convert.ToInt32(textBox1.Text);

            byte percentValue = CMTools.getByteFromPercent(fromTxtBox);

            byte[] sendValue = new byte[1];
            if (chkLftDsp.Checked)
            {
                sendValue[0] = percentValue;
                cm.SendBytes(sendValue);
            }
            if (chkRhtDsp.Checked)
            {
                sendValue[0] = (byte)(64 | percentValue); // Set the Disp ID # to 1 for the right display
                cm.SendBytes(sendValue);
            }
            //MessageBox.Show(sendValue.ToString());
        }
Exemplo n.º 2
0
        private void tmrRhtGauge_Tick(object sender, EventArgs e)
        {
            if (!cm.isOpen())
            {
                openPort();
            }

            byte[] sendByte = new byte[1];
            sendByte[0] = (byte)(AGConstants.DISP_ID_1 | CMTools.getByteFromPercent(rhtStatWrapper.getValue()));
            cm.SendBytes(sendByte);
        }