Using the Module13.2 GoPlus2 ・ 使用 Module13.2 GoPlus2
M5StackのModule13.2 GoPlus2をコントローラーに接続する最小構成。配線とBOMつき。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| M5Stack CoreS3 | Controller | grove_i2c, grove_analog, grove_uart, mbus, usb_c, sdcard | official page — $59.9 |
| Module13.2 GoPlus2 | module | mbus, grove_i2c, other:PORT-B (analog/digital I/O), other:DC motor output x2, other:Servo output x4, other:IR transmit/receive | official page — $15.5 |
M5Stack CoreS3とModule13.2 GoPlus2を組み合わせて、モーターやサーボを制御できるようにする最小構成の組み立てガイドです。GoPlus2はCoreS3のM-Busに積み重ねるだけで接続でき、特別な配線は不要です。
# M5Stack CoreS3 + Module13.2 GoPlus2 test
# Wiring: GoPlus2 stacked on CoreS3 via M-Bus (I2C)
import time
from machine import Pin, I2C
from m5stack import lcd
# I2C initialization (CoreS3 Port.A is I2C bus)
i2c = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) # CoreS3 I2C pins
# GoPlus2 I2C address
GOPLUS_ADDR = 0x38
# Check if GoPlus2 is present
devices = i2c.scan()
if GOPLUS_ADDR in devices:
lcd.clear()
lcd.print('GoPlus2 Found!', 10, 20)
else:
lcd.clear()
lcd.print('GoPlus2 not found!', 10, 20)
raise SystemExit
# Motor control registers (from GoPlus2 datasheet)
MOTOR1_CTRL = 0x00 # byte: 0=stop, 1=forward, 2=backward
MOTOR2_CTRL = 0x01
MOTOR1_SPEED = 0x02 # 0-255
MOTOR2_SPEED = 0x03
# Servo control registers (0-180 degrees)
SERVO1_ANGLE = 0x10
SERVO2_ANGLE = 0x11
SERVO3_ANGLE = 0x12
SERVO4_ANGLE = 0x13
# Test sequence
lcd.print('Testing motors...', 10, 50)
# Motor 1 forward at half speed
i2c.writeto_mem(GOPLUS_ADDR, MOTOR1_CTRL, bytes([1]))
i2c.writeto_mem(GOPLUS_ADDR, MOTOR1_SPEED, bytes([128]))
time.sleep(1)
# Motor 1 backward
i2c.writeto_mem(GOPLUS_ADDR, MOTOR1_CTRL, bytes([2]))
time.sleep(1)
# Stop motor 1
i2c.writeto_mem(GOPLUS_ADDR, MOTOR1_CTRL, bytes([0]))
lcd.print('Testing servos...', 10, 70)
# Servo 1 to 0 degrees
i2c.writeto_mem(GOPLUS_ADDR, SERVO1_ANGLE, bytes([0]))
time.sleep(1)
# Servo 1 to 90 degrees
i2c.writeto_mem(GOPLUS_ADDR, SERVO1_ANGLE, bytes([90]))
time.sleep(1)
lcd.print('Test complete!', 10, 90)
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。