Download

Using Arduino: Converting Strings to Float

I’m trying to use Arduino to make a game that reacts to input from the outside world. Right now, I’m in the testing stages, and have a single photo-receptor hooked up. The idea is that when I touch it, it causes a matinee actor to activate and move a box upwards. I downloaded and installed the Arduino plugin for Unreal, and set up my level blueprint to look like this:
5287a9d4a4d6f7b05a082b3db01f659092f15d07.png

However, the statement never seems to register as true, even when the serial output from Arduino is over 900. When I change it so that the Matinee activates when the statement registers as false, however, the matinee activates immediately. As near as I can tell, the string being read is not being converted into a float. How do I fix this? Or is there something else I may be doing wrong?

To those who read this, thank you for your consideration.

Print that string out to see what it really is. Because it its representation of number it should be translated to float.
You are also spamming play matine on event tick, you need do once there and the reset it when matinee is done with playing.
Split problem into 2 basic problems, i have strange feeling that you are fighting 2 “kicking horse contests” at once: wrong string and wrong matinee setup.

To test matinee: make some keyboard event, and when pressed play matinee, then add that do once and reset when matinee finished.
For string: print out what string really looks like.

The string → float converter gets confused when encountering a comma used as a three digit separator.
For example, the following will actually print out 1.0

example.png

If your value is larger than or equal to 1000, there is a chance the string contains a comma.

As Nawrot suggested, print it out to be sure.

I followed your advice and I think the main problem might be something with the Arduino itself! Here is a screenshot of my current blueprint now:
Blueprint Screen2.png

I’ve set it up so the string prints out if less than 800. And here is what I’ve found!
2f82057d14bdae0cf6c8f8a19b5ec89fdffab8ad.jpeg

This doesn’t make sense to me right now, because THIS is what Arduino registers on the output serial, and what Unreal should be reading from!
4f739d5c57db00a320d39c3f168db2209b4b8dbb.png

Thank you for all your help so far!