Send int from C# over Serial

If you send an integer from C# (or any other PC program) it will be received by the Arduino as 2 bytes - let's call them b0 and b1. You can convert them to an integer simply by multiplying b0 x 256 and adding b1.

BUT ... you have to know whether C# sends the high byte or the low first. The maths in my first para assume the high byte is sent first (I don't know C#).

If you want a more sophisticated approach (which works if C# uses the same byte order as the Arduino) you could use a C/C++ UNION to define an area of memory both as an array (into which the two bytes are saved) and as an INT from which the integer is read.

...R