byte[] data = Encoding.ASCII.GetBytes(txentree.Text); byte[] commande = new byte[data.Length + 1]; data.CopyTo(commande, 0); commande[commande.Length - 1] = &h13; mySerialPort.Write(commande,0,commande.Length);
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionbyte[] data = Encoding.ASCII.GetBytes(txentree.Text); byte[] commande = new byte[data.Length + 1]; data.CopyTo(commande, 0); commande[commande.Length - 1] = 0x13; mySerialPort.Write(commande,0,commande.Length);???
string data = txentree.Text+(char)13; //où 13 est le code de \r ou retour-chariot byte[] commande = Encoding.ASCII.GetBytes(data); mySerialPort.Write(commande,0,commande.Length);C'est tout con et ça marche.