Using the Hat RS485 ・ 使用 Hat RS485
M5StackのHat RS485をコントローラーに接続する最小構成。配線とBOMつき。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| SwitchC6 | Controller | terminal_block, gpio, other:User button, other:Wi-Fi 6 / ESP-NOW wireless | official page — $19.95 |
| Hat RS485 | hat | rs485, gpio | official page — $4.5 |
M5Stack SwitchC6とHat RS485を接続して、RS485通信をテストするための最小構成の配線ガイドです。SwitchC6のGPIO端子を使ってHat RS485とUART通信を行います。
# M5Stack SwitchC6 + Hat RS485 (UART communication test)
# Wiring: SwitchC6 GPIO1 (TX) -> Hat RS485 RX, GPIO2 (RX) -> Hat RS485 TX, GND -> GND
from machine import UART, Pin
import time
# Initialize UART on GPIO1 (TX) and GPIO2 (RX) with baudrate 115200
uart = UART(1, baudrate=115200, tx=Pin(1), rx=Pin(2))
# Send a test message
message = "Hello RS485!\n"
uart.write(message)
print("Sent:", message)
# Wait for echo
time.sleep(0.1)
if uart.any():
response = uart.read()
print("Received:", response)
else:
print("No response received")
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。