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

@HysiK That error means invalid Handle. It doesn’t help much. Are you using the monitor with Arduino at the same time as you use it with Unreal? Because you can’t open a COM port for two programs at once.

@game_master_jodan Nice one, man!

Hi, I previously had a project working in Unity, I have jumped ship and would like to now have the following MyoWear Sensor ] working in UR4 with a little help from the URDuion Plugin. Please would some one take a little time to help me. ? I am happy to speak directly on a live chat / video chat to speed thing up and donate a little for your help.

Please contact me asap.

Can I have some help creating the Blue prints / Functions / Variables Please?

I’ve gotten the Blueprint to work and am able to control elements within the game engine now (Yay!)
However, I’m not sure if it’s the Blueprint or what but I am getting a flashing every now and then even when the button is held down.

When I watch my serial monitor it seems consistent, but it’s hard to tell. Is there a known issue with the plugin or maybe issues with how I have approached this that could do that, or should I focus on the hardware side of things?

@PolyBionics I answered you on Skype :slight_smile:

Your Blueprint seems pretty solid to me. Is there some delay on the Arduino loop code? Because then, even with the button being held down, Unreal would read a non-zero byte on one frame and then, for several frames, read nothing (that gives you zero). So Arduino should be sending the bytes to Unreal at least as fast as UE can read them each frame. Or even faster (bytes wouldn’t accumulate because you’re preventing that with FlushPort, so no problem)

This does not appear to work for ports over 10. This worked geat for lower ports but I don’t have any available one the machine at work Is there a workaround?

Hey,
I’m doing a C++ UE4 project. please assist me how to use this plugin in C++.
thank you

I’ve just tested in a packaged game using COM 13. Worked just fine. Look for errors in the Output Log to see what’s not working.

What’s your understanding level of C++ in Unreal? Where are you stuck?

Getting the exact same thing.
Using the provided script “ArduinoTypesExample”.
It works on the Serial Monitor on the IDE if I type in “lines”, but getting nothing on the UE editor. Lines comes out as blank, Float as 0.0 and Integer as 0.

I know the Arduino to UE communication is working, because I made a light turn on/off with a button using this example : https://www.arduino.cc/en/Tutorial/DigitalReadSerial

What I did notice is that typing the commands on the Serial Monitor only works if “No line ending” is selected, the other options return nothing. Could this be the issue since there is option for that in the “Write LIne End” in Blueprint?


Just to add one more info on my last post:
The RX light on the arduino board does lit up every time press the “F” key, so something is happening… just not seeing the result on the board.

Is a chance to get binaries for 4.18 unreal version?

Added it to the latest release

That’s weird. This is my setup:


And it works. Baud Rate is set to 9600 to match the script’s.


Thanks for the 4.18 update!

Thing remain the same on my end. Everything works on the SERIAL MONITOR, but nothing happens on the Editor.
Furthermore, when I package the project to WIN64 (which was not working for either versions on 4.17) , I cannot open any port. I did a loop to go through 1-50 port, but they all turn FALSE.

image_121594.png
Editor Output Log


Setup


Unable to open port when running EXE

d4edf1c58fcb4beae9041370ddf03275.png
Running error on WIN32 (4.18) and Wind32/64 on 4.17.

knotFF, you can’t use the same port in UE and in Serial Monitor at the same time :slight_smile: I had this problem, just close Serial Monitor and UE4 will now can use the port.
, thank you for the 4.18 binaries :slight_smile:

Sure thing. But what I meant was, I can see it working in the Serial Monitor, where I type in “lines” or “float” or “int”, I get the desired feedback. On the other hand, when I run it on the UE Editor, with the Serial Monitor closed (otherwise the COM port won’t open), I get no reading from Arduino.

This is what I should be getting (image from @](https://forums.unrealengine.com/member/30654-) post #12):

image_121594.png

But this is what I get:
image_121594.png

You can see I get nothing after the brackets and the FALSE printed there is because the comparison to the text, which is turning negative.
Nonetheless, when I make a build of a level and run the EXE, I cannot open any PORT, even looping the OPEN PORT from 1-50. This is the happening on 2 different machines.
I wonder if I am missing some Library or something like that.

@DanielDurys You are welcome, mate!

@knotFF You are also welcome and, as for your problems, solutions follow below. Hope these help!

I’ve had the port not opening problem in a project, without errors or anything, and the problem was that Unreal simply was not compiling the plugin. It also happened with another plugin in another project. Seems kinda random.

After some fiddling (days of it) the solution was to make the plugin not load by default and re-enable it in the plugins window. Here’s how you do it without corrupting any Blueprints already using the plugin:

  • Close the editor
  • Open the [Project]\Plugins\UE4Duino\UE4Duino.uplugin file in a text editor (like Notepad)
  • Change **“EnabledByDefault”: true **to false
  • Open the **[Project][Project].uproject **file in a text editor
  • Before the final closing curly bracket (}) add a comma and:

"Plugins": 
	   {
	       "Name": "UE4Duino",
	       "Enabled": true
	   }
	]

  • Save both files, launch the project and build it to test. Avoid Win32 as it never worked for me without VS 2015. And the error message window you posted has to do with DirectX, not the plugin ([FONT=courier new]WindowsD3D11Device.cpp).

As for the “Arduino not responding back in Unreal” problem, found the issue:
You are sending the [FONT=courier new]float command, not [FONT=courier new]lines. So the script answers with 4 bytes that make a float. That doesn’t end with a line break, thus [FONT=courier new]ReadLine won’t work (even for reading the bytes).

@
Thanks so much for the plug-in solutions not loading on build. That was spot on:

No in regards to the “UE4Duino/ArduinoTypesExample”, I continue to get no data from Arduino<>Unreal. When I use “lines” I get nothing back (Read Line), when I use float (ReadBytes+BytesToFloat or ReadAFloat) I get “0.0”. Same with ''int", where I get a “0”.


b47cc60c2117364d82dde221733be4d3.png

Hi - thanks for the plugin - a great creation!
I am having a small problem with my sensor readings.I am bringing in a float from Arduino which has two decimal places (1.05, 3.09, 0.01 etc).

The sensor readings appear fine on the serial window in Arduino…but when I bring the float readings into unreal the data is not so clean.
I think the data readings when brought into unreal sometimes get jumbled up…for example it seems as though sometimes the float value is put on two lines instead of one line.
I have tried using read float and read line but no improvement with either.

I have not included “? is valid” or put in a “0.1 delay” - could this cause a problem ?
Is it better not to bring in decimal points - should I multiply all data by 100 in arduino and bring it in as an int and then divide inside my blueprint ?
Any advice would be great.

Hi - as per my last message this is what is causing issues with my readings (in the screenshot one of the lines appears as it should and the other appears on two lines)…any ideas?