RGB status indicator ・ RGB状态指示
CoreS3 と Unit RGB を使って、LEDの色で状態を知らせるシンプルな構成。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| M5Stack CoreS3 | Controller | grove_i2c, grove_analog, grove_uart, mbus, usb_c, sdcard | official page — $59.9 |
| Unit RGB (SK6812) | RGB LED indicator | grove_i2c | official page — $3.95 |
M5Stack CoreS3とUnit RGB(SK6812)を使って、LEDの色で状態を知らせるシンプルなインジケーターです。CoreS3がI2C経由でRGB LEDを制御し、プログラムに応じて色を変えられます。
# M5Stack CoreS3 + Unit RGB (SK6812) status indicator
# Wiring: Unit RGB -> CoreS3 red Port.A (I2C)
import time
from machine import Pin, I2C
from m5stack import lcd
# Unit RGB uses I2C address 0x38 (default)
# SK6812 driver via I2C (similar to NeoPixel)
i2c = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) # Port.A pins on CoreS3
# Unit RGB I2C command: write 0x00 then 3 bytes per LED (R,G,B)
# For 3 LEDs, send 9 bytes total
def set_rgb(leds):
# leds: list of tuples (R,G,B) for each LED, 0-255
buf = bytearray([0x00]) # command byte
for r,g,b in leds:
buf.extend([r, g, b])
i2c.writeto(0x38, buf)
# Example: cycle through red, green, blue
colors = [
[(255,0,0), (0,0,0), (0,0,0)], # LED1 red
[(0,255,0), (0,0,0), (0,0,0)], # LED1 green
[(0,0,255), (0,0,0), (0,0,0)], # LED1 blue
]
while True:
for leds in colors:
set_rgb(leds)
lcd.clear()
lcd.print('Color: ' + str(leds[0]), 10, 20)
time.sleep(1)
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。