# XOD & UE4 Serial Communication

**URL:** <https://forum.xod.io/t/xod-ue4-serial-communication/3260>\
**Category:** Uncategorized\
**Created:** [January 9, 2020, 11:29pm UTC](https://forum.xod.io/t/xod-ue4-serial-communication/3260 "2020-01-09T23:29:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cedro](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@cedro](https://forum.xod.io/u/cedro)\
**Post date:** [January 9, 2020, 11:29pm UTC](https://forum.xod.io/t/xod-ue4-serial-communication/3260/1 "2020-01-09T23:29:46Z")

</div>

Hello,

I’m trying to use XOD for communication with Unreal Engine via UE4Duino. I have the UE4 side working well enough. I can transmit a receive data with the sample Arduino code provided as the UE4Duino “Hello World”.

> **[Unreal to Arduino](https://docs.google.com/document/d/1NrniFYVNNPGGG4u4qjG2lXaYHbfSCqHy22du38odMc4/edit)**
>
> UE4Duino: Arduino ←→ Unreal 4 2019 Tutorial By Shaun Foster Download Plug-in (latest HERE: Latest Version tested for 4.22) Link on the Forums 4/2019 Arduino Nodes BlueprintUE Getting Started: Download Arduino → Unreal PLUGIN for Arduino...

Here is an example of the code based communication.

```auto
char inChar;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  // Configure LED
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  while(Serial.available()){
    inChar=Serial.read();
    doStuff(); 
  }
  delay (1);
}

void doStuff(){
  if (inChar == '1'){
    // Turn on LED and send 'hi' message
    Serial.println("Arduino Says Hi");
    digitalWrite(LED_BUILTIN, HIGH);
    
  } else if (inChar == '0'){
    // Turn off LED and send 'bye' message
    Serial.println("Arduino Says Bye");
    digitalWrite(LED_BUILTIN, LOW);
  }
}

```

My poor coding skills give me a basic understanding of what is happening here. I need to open a Serial port and read or transmit. The closest tutorial I could find was UART communication between two Arduino’s. Not exactly with I’m looking for.

Is seems like “uart-usb” might be close to “Serial.read”

Can anyone give me some hints? I just need a few pointers on how to get data in and out via the USB cable.

Thanks!

---

<div class="post-metadata">

**Author:** ![cedro](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@cedro](https://forum.xod.io/u/cedro)\
**Post date:** [January 10, 2020, 10:40pm UTC](https://forum.xod.io/t/xod-ue4-serial-communication/3260/2 "2020-01-10T22:40:31Z")

</div>

I’ll simplify my question. I have UE4 triggered bites of 0 and 1 coming in on com port 3. The code version above works correctly. My XOD version does not compile. Here is my best attempt. Can anyone help me debug this? Is this the correct path?

[![](https://i.imgur.com/cejozD6.png) ](https://i.imgur.com/cejozD6.png)

---

<div class="post-metadata">

**Author:** ![cesars](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@cesars](https://forum.xod.io/u/cesars)\
**Post date:** [January 11, 2020, 3:53am UTC](https://forum.xod.io/t/xod-ue4-serial-communication/3260/3 "2020-01-11T03:53:23Z")

</div>

hi, are you using `uart-3`, have you tried “`uart`”? if the compilation board does not have uart-3 you will get an error when compiling

you can also try `soft-uart`

---

<div class="post-metadata">

**Author:** ![cedro](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@cedro](https://forum.xod.io/u/cedro)\
**Post date:** [January 11, 2020, 6:26am UTC](https://forum.xod.io/t/xod-ue4-serial-communication/3260/4 "2020-01-11T06:26:06Z")

</div>

I moved to UART and I’m having better success. Uploaded correctly. I can see data transfer happening on keypress from Unreal Engine. I’m now trying to drive the onboard D13 pin LED with the UE4 serial data. I expected the byte to float conversion to work but I’m not getting any LED feedback.
