[Free][Windows only] UE4Duino 2 - Arduino (COM port) communication

Read this post I wrote about the protocol scheme. And use a byte array to send to Unreal as many values as you want. In unreal, after finding your first bytes (read that post), you’ll know where your other desired bytes are to retrieve your variables.

The BytesToInt function is your friend here, but don’t use it directly on ReadBytes. You don’t know how many bytes you are reading and you need only 4 to make an Int. Also, flush the serial port after opening it, otherwise you’ll be reading all the data sent from Arduino before the BeginPlay event in the engine. And, last but really important, USE THE PROTOCOL scheme described on the aforementioned post. If you don’t, you’ll never know if the 4 bytes you are reading are from the same Int. You could be reading the last 2 of an Int and the first 2 of the next one. Arduino and Unreal won’t work in sync, that’s why we use a protocol. To find when the next package of data starts and make Unreal read your values from their actual beginning.