Read data in Arduino using C# Visual Studio


I am doing a project and I need the data received by the arduino board using C#. I've been trying to open the serial port to read the programming in arduino but it doesn't read any data.

Thank you.

A possible problem is that your C# code does not wait for the Arduino to reset after it opens the Serial port. Also, PC programmers often close and reopen serial ports but that is not suitable with an Arduino as it will reset with every re-open.

A simple way to deal with this is to have the Arduino send a short message from setup() - for example Serial.println("I'm ready"); - and for the PC program to wait until it receives that message before proceeding.

The demo Python and Arduino code here might help to illustrate the idea.