Hola:
En C# para enviar un byte al puerto serie uso esto.
private void button_t_Click(object sender, EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x74; //ASCII letter "t".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
En C++/CLR su código es este.
(https://social.msdn.microsoft.com/Forums/getfile/800439)
Para enviar de forma de cadena en C# se hace así:
private void button_b_Click(object sender, EventArgs e)
{
byte[] mBuffer = Encoding.ASCII.GetBytes("Hello World");
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
¿Cómo se hace en C++/CLR?
Saludos.
Resuelto, me respondo a mi mismo.
En Visual C++ CLR se hace así:
array<Byte>^mBuffer = Encoding::ASCII->GetBytes("ACTUALIZAR"); // Envía comando ACTUALIZAR por el puerto.
serialPort1->Write(mBuffer, 0, mBuffer->Length);
Saludos.