Announcement

Collapse
No announcement yet.

ue4Duino + Multiple floats [Problem]

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

    ue4Duino + Multiple floats [Problem]


    HI.
    I am having some problems sending multiple floats messages to Unreal Engine 4 from arduino

    I can send one float and it works fine. but when i try to send two floats the code start to glitch in ue4.
    I think the problem is in the arduino code. i went to the arduino forum https://forum.arduino.cc/index.php?topic=506705.0 and there they said me that i need to send the exact type of message that ue4 is expecting to see. So i come here to know what message we are talking about.


    Anyone can help me with the arduino code for the plug in?

    here is the arduino code NOT WORKING (is from the example that come with the plug in).




    float flexpin = 0;

    void setup() {

    Serial.begin(9600);
    Serial.setTimeout(5);
    }


    void loop() {
    if (!Serial.available()) return; String str = Serial.readString();

    if (str == "float") {

    float a=analogRead(flexpin);
    float fVal = a;
    byte* fBuffer = reinterpret_cast<byte*>(&fVal);
    Serial.write(fBuffer, 4);

    float a1=analogRead(flexpin);
    float fVal1 = a1;
    byte* fBuffer = reinterpret_cast<byte*>(&fVal1);
    Serial.write(fBuffer1, 4);

    }

    }


    I already know that i can´t send two float inside a bit. but i can´t find out how can i send multiple values.

    Here is a image of the blueprint.




    Attached Files
    ue4duino blueprint
Working...
X