Send int from C# over Serial

Hi,

I wrote a library that does exactly this, and more: it allows you to send commands with arguments from .NET (C#) to your Arduino and vice versa. It supports both sending commands in clear text as well as in binary format.

see this forum topic
forum.arduino.cc/index.php?topic=186928.msg1408426

And the playground entry:
http://playground.arduino.cc/Code/CmdMessenger

Note that in C# Ints are indeed 4 bytes, but at Arduino side it depends on the board: The ATMega chips work with 2 byte Ints, whereas the ARM chips work with 4 byte Ints. Something similar applies to Doubles, see http://thijs.elenbaas.net/2014/05/arduino-to-pc-messaging-improved-speed-compatibility-and-testing/:

This is why you should probably use int16_t and int32_t instead. I have never experienced Endianess issues. Good luck!