Using the Unit Key ・ 使用 Unit Key
M5StackのUnit Keyをコントローラーに接続する最小構成。配線とBOMつき。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| AtomS3 | Controller | grove_i2c, i2c, spi, gpio, usb_c | official page — $15.5 |
| Unit Key | unit | grove_analog | official page — $3.95 |
M5Stack AtomS3とUnit Keyで作る、シンプルなボタン入力装置です。Unit Keyの青いタクタイルスイッチを押すと、AtomS3の画面に状態が表示され、内蔵LEDが光ります。配線はGroveケーブル1本で完了し、はんだ付け不要です。
# M5Stack AtomS3 + Unit Key (button input with LED)
# Wiring: Unit Key -> AtomS3 black Port.B (Grove analog/digital)
import time
from machine import Pin
from m5stack import lcd
# Port.B on AtomS3: GPIO pin for button input (G1 on AtomS3 Grove)
button = Pin(1, Pin.IN, Pin.PULL_UP) # button pulls low when pressed
# LED control pin (built-in SK6812 on Unit Key is not directly accessible via GPIO,
# but we can use the AtomS3's built-in LED for feedback)
led = Pin(27, Pin.OUT) # AtomS3 internal RGB LED (GPIO27)
while True:
if button.value() == 0: # button pressed (active low)
lcd.clear()
lcd.print('Button: PRESSED', 10, 20)
led.on()
else:
lcd.clear()
lcd.print('Button: RELEASED', 10, 20)
led.off()
time.sleep(0.1)
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。