Write multiple values through serial port from C#

Hi guys,

I am new in programing... I have windows form app in c# and I want to write some variables through serial port to arduino. One value should be 0 - 255 which represents DC motor velocity and second value its direction. I would like to write this values from c# into array or sth like that, send them through serial port, read them in arduino and both values write separately to two different variables and than work with them in arduino porgram.

Is there any correct way or some other methods how to do it?

Thank you for your help :)

For receiving the data in the Arduino have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

For help with writing a C# program you will need to ask on a C# Forum.


C# can use the SerialPort component from the toolbox to communicate with an arduino via a COM port