Unity Freezes when I move the servo slider in play mode

Issue #5 resolved
Albert created an issue

Create a simple script for servo control, or just run the simple servo example from the website. Then, during play mode, click on the uduino game object. In the inspector start moving the slider for the servo pin. The entire game engine will freeze after a few seconds.

Comments (9)

  1. Marc Teys repo owner

    Thanks Albert for your informations about servo. I'll try to reproduce the errors and fix that tommorow.

  2. Albert reporter

    Thanks Marc. Let me know if I can help in some ways. I will be doing Unity all day tomorrow. Could you also explain what is the purpose of the first argument in: UduinoManager.Instance.analogWrite("uduinoBoard", servoPin, servoAngle);

  3. Marc Teys repo owner

    Hi Albert,

    The servo issue was present because the motors were not properly "detached" when the came was stopped. This issue should be fixed. Can you send me an email to share the new .unitypackage while the update is pushed to the asset store ?

  4. Albert reporter

    I am now trying the version you sent me and am finding some additional bugs.

    1. "Discover Ports" does not always work: If I run the "Uduino" scene, select the Uduino game object and click on "Discover Ports" this always works. if I do the same for the "Servo" scene in the Examples>>Basic>>Servo folder, this never works and console reports the following message when in debug mode: "Port [COM9] is blacklisted. If I do the same on the "ReadWrite" scene in Examples>>Basic>>ReadWrite this works If I do the same for the "FadeInOut" scene in Examples>>Basic>>FadeInOut it never works and the console always says: "Error on port {\.\COM9] : System.IO.IOException: Access id Denied. However, when I remove the Uduino game object from the scene and drag in the Uduino prefab, it works.

    2. The Freezing issue has not been fixed yet.

    3. In the example Servo.cs, the variables servoPin and servoAngle is better to be private. Because when they are public variable,s if you modify their initial values in the script that has no effect unless you also modify their values in the inspector. When they are private, your don't have to make any manual changes in the inspector.
  5. Albert reporter

    In regards to the freezing issue, the slider for the Uduino game object could simply be disabled during gameplay to prevent this problem. The freezing could be happening because both the script and slider are trying to control the servo at the same time.

  6. Marc Teys repo owner

    The com9 port is probably marked as blacklisted, see on Uduino>Advanced>Blacklisted ports.

    I cannot reproduce the freezing issue, can you give me more informations on your OS, Unity version and Arduino board ? Edit: I just reproduced the issue; I'm going to work on that

  7. Albert reporter

    Something got broken during the update because with 1.4.3 now the servo makes a loud noise and takes several seconds to move. And it often does not even change position at all. The earlier version 1.4.2 was free from those problem. I tried moving the servo angle slider and that did not freeze the engine this time, but it also did not move the motor much.

  8. Log in to comment