Emergency panic button ・ 紧急按钮
押すと通知を送るコンパクトな緊急ボタン。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| AtomS3 Lite | Controller | grove_i2c, gpio, usb_c | official page — $7.5 |
| Unit Button | Emergency button | grove_analog | official page — $2.25 |
AtomS3 LiteとUnit Buttonで作る、かんたんな緊急ボタン通知装置です。ボタンを押すとWi-Fi経由で通知を送信します。
# M5Stack AtomS3 Lite + Unit Button (Emergency Button Notifier)
# Wiring: Unit Button -> AtomS3 Lite black Port.B (GPIO)
import time
import network
from machine import Pin
from m5stack import lcd
# Wi-Fi settings
SSID = "your_SSID"
PASSWORD = "your_PASSWORD"
# Button pin (Port.B on AtomS3 Lite: GPIO 26)
button = Pin(26, Pin.IN, Pin.PULL_UP)
# Connect to Wi-Fi
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, PASSWORD)
# Wait for connection
while not wlan.isconnected():
time.sleep(0.5)
lcd.clear()
lcd.print("Wi-Fi connected", 10, 20)
# Main loop
while True:
if button.value() == 0: # Button pressed (active low)
lcd.clear()
lcd.print("Button pressed!", 10, 20)
# Add notification code here (e.g., HTTP request)
time.sleep(1) # Debounce
while button.value() == 0:
time.sleep(0.1)
time.sleep(0.1)
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。