Skip to content

Instantly share code, notes, and snippets.

@vestige
Last active January 25, 2026 06:10
Show Gist options
  • Select an option

  • Save vestige/4e2a464aa41dbccdef218127ce38134c to your computer and use it in GitHub Desktop.

Select an option

Save vestige/4e2a464aa41dbccdef218127ce38134c to your computer and use it in GitHub Desktop.
from machine import Pin
import time
# 静電容量タッチセンサーを接続しているピンを設定
touch_sensor = Pin(28, Pin.IN)
while True:
# タッチセンサーの値を読み取り、タッチされているか確認
if touch_sensor.value() == 1:
# タッチセンサーがタッチされている場合
print("Touched!")
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment