XOD & UE4 Serial Communication

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”.

Here is an example of the code based communication.

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!

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?

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

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.