I come from Delphi with the following code:
// COM port received data processing
procedure TMainForm.CommPortReceiveData(Sender: TObject; Buffer: Pointer;
redata: array[0..290] of byte;
move(Buffer^, pchar(@redata)^, BufferLength); // copy data from COM buffer
And I want to do the same thing in C#:
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
byte byteReadData = new byte;
serialPort1 = (SerialPort)sender;
string indata = serialPort1.ReadExisting();
// copy data from COM buffer ???
I don't know how to take the data from SerialDataReceivedEventArgs and copy it to my byte array byteReadData.
This is what I write to serial port: https://i.imgur.com/x8oK5PI.png
This is what I should be reading from serial port but it fails: https://i.imgur.com/WQNhmqa.png