找回密码
 立即注册
搜索

[编辑器/功能拓展] Ardity Arduino + Unity communication made easy 1.1.0免费

[复制链接]
183 |0
发表于 2023-1-4 22:12:56 | 显示全部楼层 |阅读模式



Want to connect your Arduino to Unity over a COM port?
Ardity allows bidirectional communication over COM ports from Unity.
(Ardity was previously called SerialCommUnity, in case you are wondering.)

How does it work?
You need to add one of Ardity's prefabs to your scene, you configure it with the COM port your Arduino is hooked to, and tweak other config options if you want.
This prefab will do all the thread management, queue synchronization and exception handling for you. It's that easy.

There are several included scenes that show how to read/write data from/to a serial device, so you can start from the samples.

How simple is it to get it working?
Ardity supports two ways of getting data out of your Arduino:
* You can create a message listener, and Ardity will invoke its OnMessageArrived method each time a message comes from Arduino.
* It can put every message coming from Arduino into a queue, and you can retrieve the next message from the queue by invoking the SerialController.ReadSerialMessage() method.

To send data to your Arduino invoke the SerialController.SendSerialMessage() method.

Other features include:
* Using your own custom delimiters for the messages. Defaults to the newline character `\n`.
* Notifying of connect/disconnect events.



想要通过COM端口将Arduino连接到Unity ?
arity允许Unity通过COM端口进行双向通信。
(如果你想知道的话,arity之前被称为SerialCommUnity。)

它是如何工作的?
你需要在你的场景中添加一个arduity的预装件,用Arduino连接的COM端口配置它,如果你愿意,还可以调整其他配置选项。
这个预制件将为你做所有的线程管理,队列同步和异常处理。就是这么简单。

有几个包含的场景展示了如何从串行设备读取/写入数据,因此您可以从示例开始。

让它工作起来有多简单?
Ardity支持两种方式从Arduino中获取数据:
*您可以创建一个消息侦听器,每次来自Arduino的消息时,Ardity都会调用其OnMessageArrived方法。
*它可以将来自Arduino的每条消息放入队列中,您可以通过调用SerialController.ReadSerialMessage()方法从队列中检索下一条消息。

要向Arduino发送数据,请调用SerialController.SendSerialMessage()方法。

其他特点包括:
*为消息使用自己的自定义分隔符。默认为换行符' \n '。
*通知连接/断开事件。



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表