LoginSignup
0
0

【高先さんの電子工作】第9回:アクティブブザーを使ってアラームを作る

Last updated at Posted at 2023-09-12

main.py
from machine import Pin
from utime import sleep

buzzer = Pin(14, Pin.OUT, value=0)
button = Pin(15, Pin.IN)

print('秒数を入力して下さい。')
seconds = int(input())
sleep(seconds)
buzzer.on()

while True:
    if button.value() == 1:
        buzzer.off()
        break
    sleep(1)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0