Search Unity

ARDUINO + Unity = ARDUnity

Discussion in 'Assets and Asset Store' started by SmartMaker, Sep 27, 2016.

  1. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    Hello,

    I will introduce a good asset to communicate between ARDUINO and Unity.
    You can find this asset in Asset Store

    First, see this video about example of ARDUnity.


    ARDUnity has special features.
    • You can automatically create ARDUINO sketch.
    • You can customize ARDUINO sketch in Unity Editor.
    • You can design ARDUINO sketch using Visual Tool.
    • It supports variety connection between ARDUINO and Unity. (Serial, Bluetooth, WiFi...)
    • Any device can be controlled, when is compatible with ARDUINO.
    • PlayMaker supports perfectly.
    See this video about workflow.


    If you use ARDUnity, you will be able to perform a very interesting project.
    [Control RC Car]


    [Control Robot]


    [Develop a new type of game controller]


    If you want to know more detail about ARDUnity, please visit follows.

    Please a lot of attention.
    Thank you.
     
    Last edited: Aug 16, 2017
  2. Max_Dirav

    Max_Dirav

    Joined:
    Sep 2, 2016
    Posts:
    4
    Can we use sensors?
     
  3. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    What kind of sensor device do you want?
    Currently, it contains examples for the following sensors.
    • Push Button
    • Potentiometer
    • Soft Potentiometer
    • Photocell (Light Sensor)
    • TMP36 (Temperature Sensor)
    • Flex Sensor
    • Piezo Sensor (Knock Sensor)
    • MPU-XXXX (IMU Sensor) - Deluxe only
    In addition, it can control many other sensors.
    Also, it can control custom sensor by scripting.

    If you want to ask about this more detail, please visit forum. (Go Forum)
     
  4. Max_Dirav

    Max_Dirav

    Joined:
    Sep 2, 2016
    Posts:
    4
    I want to connect unity with 3d accelerometer and magnetometer. I'm really interested to Ardunity but still learning unity for now.
     
  5. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    I recommend that you use one of MPU-6050/6500/9150/9250.
    These sensor already are included as name of 'MPUSeries' in ARDUnity Deluxe.
     
  6. theFinder

    theFinder

    Joined:
    Apr 30, 2016
    Posts:
    17
    Trying to use OSEPP motor shield on mega clone board. I can't figure out which?
    1 PWM 1 Dir
    2 PWM 2 Dir
    1 PWM 2 Dir
    or which pin #'s to assign. I've looked everywhere, all manufacturers, your online docs/forums, youtube, and no luck.
    Is it possible that this Shield is not supported by the Ardunity Deluxe Asset? I have used the shield in the past with the AF MOTOR SHIELD library and it worked perfectly, but I don't know how to include this library with Ardunity.
    Tried all motor samples with a variety of pin configurations and none worked.
    The LED and Bluetooth samples all worked perfectly (thanks).
     
  7. theFinder

    theFinder

    Joined:
    Apr 30, 2016
    Posts:
    17
    nevermind. i was able to include other Arduino libraries and modify the generated code to run the motors. works good with Bluetooth.
    thanks
     
  8. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Can I implement these projects by using only one sensor which is MPU 9250 (9 axis motion tracking device)?
     
  9. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
  10. rizawerx

    rizawerx

    Joined:
    May 30, 2013
    Posts:
    38
    Hi, I'm interested in this plugin, but I wonder if it can communicate with HM10 BlueTooth ?
     
  11. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
  12. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Is It possible to make transformation movement by using Accelerometer data or Accel + Gyro ?
     
  13. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    ARDUnity Deluxe includes the IMU Sensor feature named MPUSeries.
    MPUSeries refers to MPU6050/9250 and so on.
    It includes Accelerometer, Gyro, Compass.
    ARDUnity allows you to control the rotation of the transformation by quaternion from MPUSeries.
    Watch the demo with the youtube link.
     
  14. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115

    this is not transformation movement.
    You just used object.transformation.Translate(Vector3)

    watch this:


    I need both sensor and object in the scene parallel movement.
     
  15. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    I'm sorry.
    I misunderstood your question.
    MPUSeries is not yet able to extract translation information.
     
  16. Tiax

    Tiax

    Joined:
    Oct 25, 2017
    Posts:
    5
    Hi, I'm having some issues with Ardunity, which means I'm hesitant to buy the full version just yet.

    Basically, everything I do with analog inputs is working properly, but I can't make the DigitalInput work in my case. I'm using a switch, the DigitalInput script responds properly to its changing state but I can't link the value of another script's variable (a boolean) to the value of DigitalInput.

    I saw that in the inspector, the value of the DigitalInput script is displayed as two TRUE and FALSE buttons, instead of the checkbox that Unity uses for displaying every other boolean.

    Could you provide a script example (used in a different GameObject) that would allow me to get the bool value ("true" or "false") from DigitalInput and assign it to a new value? I'm new to Unity and it's possible that I'm doing something wrong.
     
  17. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    All components of ARDUnity can be controlled by Script.
    DigitalInput can know the state with a property called Value.
    (https://sites.google.com/site/ardunitydoc/references/controller/digitalinput/digitalinput-script)
     
  18. Tiax

    Tiax

    Joined:
    Oct 25, 2017
    Posts:
    5
    I've read your documentation, but it's not telling me how to link a variable in another gameobject's script to the Value property of DigitalInput.

    This is the part of my script where I'm trying to refer to DigitalInput Value, the gameobject PhaseLockSwitch is an empty object on which I added the DigitalInput component (and it works properly, ie when the game runs and I use the physical switch, the value on this component moves from FALSE to TRUE) :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4.  
    5. public class SineWave1 : MonoBehaviour {
    6.  
    7.  
    8.     public GameObject PhaseLockSwitch;
    9.  
    10.     public Ardunity.DigitalInput externalphasescript;
    11.     public bool externalphaselockvar;
    12.     public bool phaseLock = false;
    13.  
    14.  
    15.     void Start () {
    16.  
    17.  
    18.  
    19.         externalphaselockvar = externalphasescript.Value;
    20.  
    21.         phaseLock = false;
    22.         PhaseLockStatus.text = "PHASE LOCK DEACTIVATED";
    23.     }
    24.  
    25.     void Update () {
    26.  
    27.    
    28.         phaseLock = externalphaselockvar;
    29.  
    30.  
    31.     }
    32. }
    I'm new to Unity (and coding) so it's probable I made a mistake somewhere, but I can't figure it out.
     
  19. SmartMaker

    SmartMaker

    Joined:
    Nov 10, 2015
    Posts:
    9
    I apologize that the Ardunity Guide is not good.
    First, set up a reference to DigitalInput in the Inspector window.
    Watch this video on how to do this.


    Then you can access the following in Script:
    Code (CSharp):
    1. using UnityEngine;
    2. using Ardunity;
    3.  
    4. public class YourScript : MonoBehaviour
    5. {
    6.     public DigitalInput digitalInput; // set up a reference in the Inspector window
    7.  
    8.     void Start ()
    9.     {
    10.     }
    11.  
    12.     void Update ()
    13.     {
    14.         if(digitalInput.Value == true)
    15.         {
    16.               // Performed when state of DigitalInput is HIGH
    17.         }
    18.         else
    19.         {
    20.               // Performed when state of DigitalInput is LOW
    21.         }
    22.     }
    23. }
     
  20. Tiax

    Tiax

    Joined:
    Oct 25, 2017
    Posts:
    5
    No need to apologize, I'm a total noob so it is much more likely that me not understanding your documentation is mostly on my end instead of yours.

    I'll check you script out ASAP, many thanks for your help!
     
  21. wanawatifwan

    wanawatifwan

    Joined:
    Mar 8, 2018
    Posts:
    1
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using System.IO.Ports;


    public class Try : MonoBehaviour
    {

    SerialPort stream = new SerialPort("COM3", 9600);
    //Set the port
    //and the baund rate (9600)

    public int speed; //how fast the player moves
    private Vector3 endPosition = new Vector3(-16, 9, -3);
    // Use this for initialization

    int buttonState = 0;


    // Use this for initialization
    void Start()
    {
    stream.Open(); //Open the Serial Stream
    }



    // Update is called once per frame
    void Update()
    {


    if (transform.position != endPosition)
    {
    transform.position = Vector3.MoveTowards(transform.position, endPosition, speed * Time.deltaTime);
    }
    Moveno1();
    MyInput();

    }


    void Moveno1()
    {
    transform.Translate(Vector3.back * speed * Time.deltaTime);//ke object move
    }


    void OnGUI()
    {
    string newString = "Connected:" + buttonState;//piezo pin
    }

    void MyInput()
    {
    if (Input.GetKeyDown(KeyCode.Space))//space change to piezo
    {

    }

    else if (Input.GetKeyUp(KeyCode.Space))//space change to piezo
    {
    speed = 2;//Stop the cube from moving
    }



    }

    }

    I want to change (KeyCode.Space) as a piezo knock! Some one can help me please?
     
  22. Marc-Saubion

    Marc-Saubion

    Joined:
    Jul 6, 2011
    Posts:
    655
    Hi @SmartMaker .

    I use some outputs but they are prefabs. As a result the wire editor lose the connection when I hit play. I see in your documentation that we can wire by script but the page is empty. Can you help?

    Thanks