Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I'm getting this message
    Click image for larger version  Name:	UE4Duino-error.JPG Views:	2 Size:	20.0 KB ID:	1703531

    Fixed it. I should have read earlier, but it is important to have the latest VS version installed (free community version).
    Last edited by mikec156; 01-02-2020, 11:54 PM.

    Leave a comment:


  • replied
    Originally posted by Jos_._G View Post
    Hi,

    I'm using the UE4Duino for the first time and i'm having sync problems betwee the arduino output and the UE4 input read..

    I believe that i have read most of the posts regarding this issue.
    So i'm cheking the incoming string with a prefix and suffix.
    but what i notice is that only if the incoming string is 8 characters long, i get a stable input. e.g. the prefix and suffix check results in true
    Smaller or bigger length strings, result in fewer incoming strings passing the prefix and suffix check.

    any idea why this could be?
    It's what you said. A sync issue. Unless you are losing data in between strings, than that's another issue that I haven't seen.
    Try appending the strings you get from Arduino to each other, until you have the complete "phrase". It's common to get them in pieces, because of the sync issues. Unreal can be reading before Arduino has finished writing. So append, wait for next read, append again and check for the prefix/suffix. Once you find those, remove what's before the suffix and keep appending next reads to the string. That way, your string variable will be like a buffer that you remove completed strings from.

    And never use Flush! Read until there's nothing to read. Flush will empty the serial and delete strings you had yet to read.
    Actually, just flush once when you open the comms with Arduino, to clear previously accumulated unread data in the serial, before you start reading.
    Last edited by RVillani; 12-18-2019, 02:06 PM.

    Leave a comment:


  • replied
    Hi,

    I'm using the UE4Duino for the first time and i'm having sync problems betwee the arduino output and the UE4 input read..

    I believe that i have read most of the posts regarding this issue.
    So i'm cheking the incoming string with a prefix and suffix.
    but what i notice is that only if the incoming string is 8 characters long, i get a stable input. e.g. the prefix and suffix check results in true
    Smaller or bigger length strings, result in fewer incoming strings passing the prefix and suffix check.

    any idea why this could be?

    Leave a comment:


  • replied
    If after you have built your app and the program refuses to run and in your log file you see the line

    Code:
    LogPluginManager: Error: Unable to load plugin 'UE4Duino'. Aborting.
    Make sure that you have

    Code:
    "Installed": true,
    in your UE4Duino.uplugin file.

    Leave a comment:


  • replied
    Originally posted by DoktorDangerous View Post
    Hi,
    Is there a way to check how many bytes of data are available in the serial buffer to be read? Let's say I have sent a float data (4 bytes) from the arduino to UE4, I would like to have my program on UE4 to keep checking the buffer until there are 4 bytes before reading it. Is there also a "read a specified number of bytes" function that would block until the specified amount of bytes has been read?
    Thank you.
    There's no function to read the number of bytes in the serial connection nor one that blocks until a number is read. In fact, I'd never do anything that blocks unreal intentionally, as it sounds like bad design.
    In your case I'd simply keep reading bytes from the serial with ReadBytes and storing them in an array until the array has 4 bytes. Then I'd use those 4 to make a float and clear the array. But if you're trying to do that as a way to avoid getting split bytes from Arduino (like the last 2 from a float and the first 2 from another one), that wouldn't solve it, because you could be splitting since the first time you called the function. You need to come up with a way to signal Unreal when you are going to send another float. In this thread, if you search for protocol, there's a post where I describe how I overcome this type of problem with a protocol (like a router's handshake).

    Leave a comment:


  • replied
    Click image for larger version  Name:	PluginError.jpg Views:	0 Size:	22.4 KB ID:	1683724
    I get the above error after I restart UE 4.23.1 after activating the plugin. (Win 10)
    I have tried copying the UE4Duino folder to the Engine Plugins page as well as the Projects plugin page, redownloading etc.
    Any help would be appreciated.
    Thanks

    Solved: Deleting binaries and Intermediate folders and rebuilding fixed it.
    Last edited by Hrishi_A; 11-07-2019, 02:14 PM.

    Leave a comment:


  • replied
    Hi,
    Is there a way to check how many bytes of data are available in the serial buffer to be read? Let's say I have sent a float data (4 bytes) from the arduino to UE4, I would like to have my program on UE4 to keep checking the buffer until there are 4 bytes before reading it. Is there also a "read a specified number of bytes" function that would block until the specified amount of bytes has been read?
    Thank you.

    Leave a comment:


  • replied
    Originally posted by meuliano View Post
    Thank you for building this plugin, it looks great! Quick question: Is there a built-in method of transferring data from UE4 to the Arduino IDE? For example, I want to get the vector location of an object in-game in the Arduino code.
    Thank you!
    I think your terminology is wrong because you can't send stuff to the IDE, but if I understood you correctly, you can send floats to Arduino and read them using the example code in the .ino file that comes with the plugin. It's commented, so you'll know what I mean. But you might have problems to read 3 floats in sequence, like in a Vector. 3 floats will be sent as 12 bytes, but if you do that each frame, there's no guarantee that Arduino and UE are in sync and you might read a float (4 bytes) that's actually 2 bytes from one float and 2 from another (and problems like that). So you'd need to somehow make sure you're reading the right bytes. I've written on some post on this thread about a protocol scheme I do in UE to sync data with Arduino. You'd need to do that in the Arduino code. Do a search for protocol. It's one of the biggest posts that pop up in the results.

    Leave a comment:


  • replied
    Originally posted by ShannonKoh View Post
    Hello, I'm on unreal engine 4.22.3 and am not seeing the close port blueprint.
    It's part of the functions for a Serial variable. So you can only call this function when you drag a line from one.

    Leave a comment:


  • replied
    Thank you for building this plugin, it looks great! Quick question: Is there a built-in method of transferring data from UE4 to the Arduino IDE? For example, I want to get the vector location of an object in-game in the Arduino code.
    Thank you!

    Leave a comment:


  • replied
    Hello,
    I'm on unreal engine 4.22.3 and am not seeing the close port blueprint.
    I've tried simply moving the folder like the read me says and also have tried having only the source folder placed in the plugins folder and letting the engine rebuild it but i still only see the open serial port, int to bytes and bytes to stuff.

    I've also tried installing unreal engine 4.21.2 and using the 4.21 binaries with the same result. (also tried rebuilding with the source folder here and same results)

    am i doing something wrong?
    I'm trying to find a way to output values through a serial port to a python code to then run the arduino.

    Leave a comment:


  • replied
    Originally posted by WiHilliman丶 View Post
    Any guy can tell me how to convert the ReadBytes function's output to hex?
    If you're using C++, there's this function: https://docs.unrealengine.com/en-US/...Hex/index.html
    In Blueprints, I think you'll have to write your own.

    Left digit will be byte / 16. Right digit will be byte % 16.
    Then you'll need a function to convert values higher than 9 to letters from A to F, for both digits.

    Leave a comment:


  • replied
    Any guy can tell me how to convert the ReadBytes function's output to hex?

    Leave a comment:


  • replied
    Originally posted by RVillani View Post

    It'll be really tough to find out what the problem is without seeing your code/blueprints. Does it crash if just send and receive some data from Arduino too? I mean, when you do simple comms, without using the RFID sensor.
    Hello, thanks for your super fast response. After a few hours digging, I do not think the plugin causes the crash. It's probably a structure call. Thank you anyway

    Leave a comment:


  • replied
    Originally posted by Raumgleiter View Post
    Hi thank you for this awesome plugin. Everything works fine in the editor (4.21). But in the packaged game, the game crashes when the RFID Reader, reads the line. Have you any idea how can i fix this?
    It'll be really tough to find out what the problem is without seeing your code/blueprints. Does it crash if just send and receive some data from Arduino too? I mean, when you do simple comms, without using the RFID sensor.

    Leave a comment:

Working...
X