コード例 #1
0
ファイル: Form1.cs プロジェクト: AsBilou/LPIE_Robot_Color
        private void button1_Click(object sender, EventArgs e)
        {
            Protocol ptTest = new Protocol();
            ptTest.PortSerie = gPortSerie;
            Protocol.TrameProtocole trame = ptTest.MakeTrame(0x01,0x02,0x0001,new byte[]{0x01,0x25,0x32});
            Log.log(DateTime.Now.ToString("HH:mm:ss.ffffff") + '\n');
            ptTest.SendTrame(trame);
            Protocol.TrameProtocole newtrame ;

            System.Threading.Thread.Sleep(1000);
            while (gPortSerie.BytesToRead > 0 )  // Lit les données entrantes du port com
            {
                //int data = gPortSerie.ReadByte();
            //Log.log(data.ToString());

                //Log.log(String.Format("0x{0:X}", gPortSerie.ReadByte()));
                Log.log(gPortSerie.ReadExisting());
            }

            /*while ((newtrame = ptTest.getTrame()).Equals(default(Protocol.TrameProtocole)));
            Log.log(DateTime.Now.ToString("HH:mm:ss.ffffff") + '\n');
            Log.log(newtrame.ToString());*/
        }