Announcement

Collapse
No announcement yet.

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

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

    #61
    Anyone had issues with the plugin where constant writing bytes to COM (lets say 90 times a second for 30 seconds) ends up making the write byte(s) funciton take 10ms of gamethread time. Using the write bytes function is even worse of an offender. At worst I'd like to write a total of 810 bytes (9*90Hz) a second...

    Comment


      #62
      Originally posted by AtsK View Post
      Anyone had issues with the plugin where constant writing bytes to COM (lets say 90 times a second for 30 seconds) ends up making the write byte(s) funciton take 10ms of gamethread time. Using the write bytes function is even worse of an offender. At worst I'd like to write a total of 810 bytes (9*90Hz) a second...
      Have you tried opening the connection with Arduino using higher baud rates? If I remember correctly, it controls the speed of communication.
      Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
      Unreal products: Dynamic Picture Frames, Neo Kinect

      Comment


        #63
        Originally posted by RVillani View Post

        Have you tried opening the connection with Arduino using higher baud rates? If I remember correctly, it controls the speed of communication.
        Already at 115200, though even 9600 should be enough

        Comment


          #64
          Originally posted by AtsK View Post
          Already at 115200, though even 9600 should be enough
          I haven't experienced performance problems like that, so I won't be of much help to you. I still think it may be the way you are using it.
          Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
          Unreal products: Dynamic Picture Frames, Neo Kinect

          Comment


            #65
            hey there i am currently working with a project i need to connect arduino to unreal engine developed game

            unreal needs to send output like some values given to servos and arduino should recieve it and move the servo.
            any help i am going to connect arduino with com port which will recieve the values through it

            Comment


              #66
              Hi Everyone,

              I am really new to both Arduino and Unreal and although I am slightly getting everything now. Still I can't really figure out the plugin (Definitely me ). My arduino code isn't very complicated I think but I struggle to translate it to the nodes. I basically need two buttons to be read. I made it work in the Arduino code as follows:

              // constants won't change. They're used here to
              // set pin numbers:
              const int buttonPin1 = 8; // the number of the pushbutton pin 2
              const int buttonPin2 = 9; // the number of the pushbutton pin 3


              // variables will change:
              int buttonState1 = 0; // variable for reading the pushbutton status
              int buttonState2 = 0;


              void setup() {

              Serial.begin(9600);

              // initialize the pushbutton pin as an input:
              pinMode(buttonPin1, INPUT_PULLUP);
              // initialize the pushbutton pin as an input:
              pinMode(buttonPin2, INPUT_PULLUP);
              }

              void loop(){
              // read the state of the pushbutton value:
              buttonState1 = digitalRead(buttonPin1);
              // read the state of the pushbutton value:
              buttonState2 = digitalRead(buttonPin2);

              // check whether a pushbutton is pressed.
              // if it is, the buttonState is HIGH:

              if (buttonState1 == HIGH) {
              // turn LED on: // Tweet that the washer is done
              Serial.print("BP1=");
              Serial.println(buttonState1);
              }
              else {
              Serial.print("BP1=");
              Serial.println(buttonState1);
              }
              if (buttonState2 == HIGH) {
              // turn LED on: //Tweet that the dryer is done
              Serial.print("BP2=");
              Serial.println(buttonState2);
              }
              else {
              Serial.print("BP2=");
              Serial.println(buttonState2);
              }
              }

              Also I can't seem to find all the nodes, for example 'read read serial' 'get arduino and 'close serial'. So basically I am just struggling here. Could anybody help me out how to get started.

              Comment


                #67
                Howdy!

                I got everything working with the example code, but I can't figure out how to send data from UE4, like a float or int and stick that into a variable on the Arduino side of things. In short, I'm trying to get UE4 to control components on the Arduino board.

                Thoughts?

                Cheers,

                Sterling
                Run with the flock, end up a lamb chop!

                Unreal 4 in 30 Days - An Unreal Experience: https://youtu.be/DV5l7d4b9Cs

                Comment


                  #68
                  Originally posted by SterlingY View Post
                  Howdy!

                  I got everything working with the example code, but I can't figure out how to send data from UE4, like a float or int and stick that into a variable on the Arduino side of things. In short, I'm trying to get UE4 to control components on the Arduino board.

                  Thoughts?

                  Cheers,

                  Sterling
                  You can either send data as String with Print or PrintLine functions or use Write[X] to send bytes. There are several write functions such as WriteInt and WriteFloat. But since Ints and Floats are 4 bytes each, Arduino will read those four bytes and you'll have to convert them back to an int or float using C++ logic in Arduino. It's much simpler to use just byte.
                  Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
                  Unreal products: Dynamic Picture Frames, Neo Kinect

                  Comment


                    #69
                    Originally posted by saikat005 View Post
                    I am having this error when i star the unreal project after pasting the UE4duino file to the Plugins "Binaries for the UE4Duino plugin are missing or incompatible with the current engine version."

                    Any help would be appreciated...
                    saikat005 It means the binaries were not made with the same engine version you are trying to use them with. Try installing Visual Studio with the C++ features and letting the engine compile it for you.
                    Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
                    Unreal products: Dynamic Picture Frames, Neo Kinect

                    Comment


                      #70
                      Originally posted by banjak15 View Post
                      Hellou i would like to ask you if i can make movement of charakter using arduino in Unreal Enigne with this plugin and if yes can you help with it ?
                      banjak15 To personally help you, I could give you consultation through Skype, but I charge for that. You can do it by making your character BP talk to Arduino directly. It could read values from Arduino and use those to set movement commands.
                      Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
                      Unreal products: Dynamic Picture Frames, Neo Kinect

                      Comment


                        #71
                        UE4.19.1
                        UE4Duino_2.2.1_4.19

                        Comment


                          #72
                          Seems it not support UE4.19.1 yet.

                          Comment


                            #73
                            Originally posted by Lanslot Chung View Post
                            Seems it not support UE4.19.1 yet.
                            Install Visual Studio with C++ features, generate Visual Studio project files (available through right clicking the .uproject file) and start the project. Unreal Engine should propose rebuilding of the plugin.

                            Also, set "EnabledByDefault" to true with Notepad++ in the UE4Duino.uplugin file, if you have not done that already.

                            Comment


                              #74
                              Originally posted by Finnfox66 View Post

                              Install Visual Studio with C++ features, generate Visual Studio project files (available through right clicking the .uproject file) and start the project. Unreal Engine should propose rebuilding of the plugin.
                              Thanks! That's exactly what can be done. Or else, I'd have to upload a new zip for each hotfix version of the engine. And we're already in 4.19.2.

                              Originally posted by Finnfox66 View Post
                              Also, set "EnabledByDefault" to true with Notepad++ in the UE4Duino.uplugin file, if you have not done that already.
                              Don't. There's a bug (don't know if it's still there, but it was so in 4.18) in the engine that prevents the plugin from compiling if it's set to EnabledByDefault and you use it in a component. Some people have reported it not compiling even used in the Pawn blueprint. It's like the engine considers it's not being used and doesn't compile. Then the game fails silently because a connection with the Serial port is not made. It's frustrating.
                              Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
                              Unreal products: Dynamic Picture Frames, Neo Kinect

                              Comment


                                #75
                                I think that i've found a bug, i'm sending like 6 ints via
                                Code:
                                Serial.print();
                                and in the console everything works fine but in ue4 the Read Line node tells me that there's nothing to read :/
                                Code:
                                      String str = Serial.readString();
                                
                                      if(str == "snd")
                                      {
                                        Serial.print(myIMU.roll, 2);
                                        Serial.print("/r");
                                        Serial.print(myIMU.pitch, 2);
                                        Serial.print("/r");
                                        Serial.print(myIMU.yaw, 2);
                                        Serial.print("/r");
                                        Serial.print(myIMU.ax, 3);
                                        Serial.print("/r");
                                        Serial.print(myIMU.ay, 3);
                                        Serial.print("/r");
                                        Serial.print(myIMU.az, 3);
                                        Serial.print("/r");
                                        Serial.print(v_flex1);
                                        Serial.print("/r");
                                        Serial.print(v_flex2);
                                        Serial.print("/r");
                                        Serial.print(v_flex3);
                                        Serial.print("/r");
                                        Serial.print(v_flex4);
                                        Serial.print("/r");
                                        Serial.println(v_flex5);
                                      }

                                Comment

                                Working...
                                X