ArduinoCraft
一个 Minecraft Fabric 模组,允许红石信号与 Arduino 进行双向交互。
请注意,这是我制作的第一个模组,我仍在努力学习如何制作模组,因此可能会存在一些错误或问题。如果您有任何问题或疑问,请在 Discord 上私信 @jamicah。
此模组不仅限于 Arduino。它应该适用于任何支持通过 USB 进行串行 UART 通信的微控制器。
注意:本模组需要一定的 Arduino 和串行通信知识。如果您是 Arduino 新手,建议先查阅有关 Arduino 和串行通信的教程。
功能
- 将红石信号转换为 Arduino 数字信号
- 将 Arduino 数字/模拟信号转换为红石信号
待办事项:
- 用于关闭/打开与 Arduino 通信的 GUI 菜单
使用方法
上传代码草图
您可以选择一个 示例代码草图,并使用 Arduino IDE(或您使用的其他上传工具)将其上传到您的 Arduino。我建议从 digitalRead/digitalWrite 示例 开始,以了解通信的工作原理。示例文件夹中还包含了接线图片。
启动
在 Minecraft 中,放置 Arduino 方块(来自创造模式下的红石菜单),
插入您的 Arduino 并运行命令
/arduino start <arduino port> output <baudrate>。红石到 Arduino
/arduino start <arduino port> input <analog/digital> <baudrate>。Arduino 到红石
注意:如果您不在 Windows 系统上,需要在端口名称周围加上引号。例如,在 Linux 或 MacOS 上,您可能需要使用 /arduino start "/dev/ttyACM0" output 9600。
停止
您可以使用命令 /arduino stop 来关闭端口。当您退出游戏时,模组也会停止运行。
工作原理
ArduinoCraft 通过 USB 上的串行通信与 Arduino 进行交互。
当使用输入模式时,每当方块接收到红石电源时,模组都会向 Arduino 发送信号,以在高电平或低电平之间切换引脚状态。
当使用输出模式时,模组会检查引脚状态,并向方块发送相应的红石信号。
强烈建议您查看 示例代码草图 以了解通信的工作原理。
ArduinoCraft
A Minecraft Fabric mod that allows redstone signals to interact with an Arduino and vice versa.
Please note that this was my first mod, and I'm still learning how to make mods, so there might be some bugs or issues. If you have any issues or questions, DM me on Discord @jamicah.
This mod is not only limited to Arduino. It should work with any microcontroller that supports Serial UART communication over USB.
NOTE: This mod requires a bit of knowledge about Arduino and Serial communication. If you are new to Arduino, I recommend checking out tutorials on Arduino and Serial communication first.
Features
- Convert redstone signals to Arduino digital signals
- Convert Arduino digital/analog signals to redstone signals
TODO:
- A GUI menu for closing/opening communication with Arduino
How to use
Upload a sketch
You can choose an example sketch and upload it to your Arduino using the Arduino IDE (or whatever you use to upload ig). I'd recommend starting with the digitalRead/digitalWrite example to see how the communication works. Images for wiring are also included in the example folders.
Start
In Minecraft, place down the Arduino Block (from the redstone creative menu),
plug in your Arduino and run the command
/arduino start <arduino port> output <baudrate>. Redstone to Arduino
/arduino start <arduino port> input <analog/digital> <baudrate>. Arduino to Redstone
NOTE: If you're not on Windows, you need to use quotes around the port name. For example, on Linux or MacOS, you might use /arduino start "/dev/ttyACM0" output 9600.
Stop
You may use the command /arduino stop to close the port. The mod will also stop when you quit the game.
How does it work?
ArduinoCraft communicates with the Arduino using Serial communication over USB.
When you use input, the mod will send a signal to the Arduino everytime the block receives redstone power to write high or low to the pin.
When you use output, the mod will check the pin and send a matching redstone signal to the block.
It is highly recommend that you look into the example sketches to see how the communication works.
评论 0
登录后参与评分
还没有评论,来抢沙发吧