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

I don’t know if anyone has posted this yet, but I’ve been trying to get reliable data from Arduino, to no avail.

Then, I stumbled upon 's ideaof having a protocol and made a similar setup. Hopefully, it’ll help someone.

On the Arduino, you need to add a “control” byte which tells UE where the data (float, int, etc.) starts:


Serial.write(0xFE);

After this, convert your variable into an array of bytes:



float floatVal = 23.56;
byte *b = (byte *)&floatVal;

Serial.write(0xFE);

int i;
for (i = 0; i < 5; i ++){   
    Serial.write(b*);
}

Then, in UE, you check for the control byte, then reassemble everything (minus the control byte):

Everything works like a charm, no more garbled data.
Hope this helps!

1 Like