Arduino connection with Unity2017 and UDUINO
Tags: unity3d, arduino
Published: 2020-03-26 08:13:18

＊This content was posted on Qiita in 2018.

I useArduino in Unity, but UNIDUINO doesn't seem to work well in 2017.
I tried using "UDINO", which is highly rated by the AssetStore.

use Unity2017　3.0p1　

「UDUINO」$15
https://assetstore.unity.com/packages/tools/input-management/uduino-arduino-and-unity-made-simple-78402

Basically, if you watch the video of the explanation, you'll understand.



Import.
![2018-01-27 (2).png](https://qiita-image-store.s3.amazonaws.com/0/62400/5e5afe95-7d8b-4722-7344-13ca61a4cb6c.png)


Open the demo scene.

![2018-01-27 (3).png](https://qiita-image-store.s3.amazonaws.com/0/62400/087bb1bd-8b06-884d-f9c3-15cea9a34b5c.png)


Select the UDUINO object and click, Let's check out the UduinoManager.
![2018-01-27 (4).png](https://qiita-image-store.s3.amazonaws.com/0/62400/83bacf7a-98ab-b8ac-98dd-a2cede8e073e.png)


Click on "Select path" and select the Libraries folder in your Arduino.
![2018-01-27 (5).png](https://qiita-image-store.s3.amazonaws.com/0/62400/5348472e-3f23-ddb3-3163-26ef59f3cfc1.png)


Click on "Add Uduino Library to Arduino".
This will add Uduino to the library of ArduinoIDE.
![2018-01-27 (6).png](https://qiita-image-store.s3.amazonaws.com/0/62400/2447e6b4-2835-8879-0c49-e87da6982fa9.png)

If there is no problem, "Setp done".
![2018-01-27 (7).png](https://qiita-image-store.s3.amazonaws.com/0/62400/68b2d713-26b0-e275-7edf-37c43cc4e236.png)

Click "FixNow" and if all is well, "SepNow".
![2018-01-27 (8).png](https://qiita-image-store.s3.amazonaws.com/0/62400/d37bc8a8-a5a1-d070-7d5c-38edea9a204f.png)



Let's open the ArduinoIDE and write in the Uduino we jus added.

![写真 2018-01-27 15 32 07.jpg](https://qiita-image-store.s3.amazonaws.com/0/62400/e89ca1f9-2c04-c88c-b0b0-5ef430db4df0.jpeg)


![2018-01-27 (9).png](https://qiita-image-store.s3.amazonaws.com/0/62400/3f8f8432-5356-db30-15a3-0e5155a05331.png)


![2018-01-27 (11).png](https://qiita-image-store.s3.amazonaws.com/0/62400/ddb40427-41e9-dede-390a-f19d6c267627.png)

![2018-01-27 (14).png](https://qiita-image-store.s3.amazonaws.com/0/62400/5818fad5-3914-a54c-ae45-886db8cf8670.png)

done writing.
![2018-01-27 (16).png](https://qiita-image-store.s3.amazonaws.com/0/62400/1409f716-e605-e7f7-cd6c-a619b8b85644.png)

Let's connect it to Unity.
Add a pin with number 11 and PWM mode.
![2018-01-27 (18).png](https://qiita-image-store.s3.amazonaws.com/0/62400/71fdb1d1-3e3f-dc48-3c7c-d59d82c568f9.png)


![ダウンロード.gif](https://qiita-image-store.s3.amazonaws.com/0/62400/2ce3fb13-40e1-2ceb-bd69-2bd72fe536ed.gif)

<blockquote class="twitter-tweet" data-lang="ja"><p lang="ja" dir="ltr">ぴかぴか(φωφ) <a href="https://t.co/1hp9NAKCzA">pic.twitter.com/1hp9NAKCzA</a></p>&mdash; IZUN∀@不屈のVRクリエイター (@mizuki_izuna) <a href="https://twitter.com/mizuki_izuna/status/957128348274061312?ref_src=twsrc%5Etfw">2018年1月27日</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>


When moving a servo motor, use the
You can adjust the direction of rotation by turning on No.9 and turning No.11 PWM and No.8 PWM

<blockquote class="twitter-tweet" data-lang="ja"><p lang="ja" dir="ltr">モーターぐるぐる(φωφ)！ <a href="https://t.co/ZmOyCQJOkB">pic.twitter.com/ZmOyCQJOkB</a></p>&mdash; IZUN∀@不屈のVRクリエイター (@mizuki_izuna) <a href="https://twitter.com/mizuki_izuna/status/957157658858946560?ref_src=twsrc%5Etfw">2018年1月27日</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>