"""
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Raspberry Pi Pico Template (MicroPython) ┃
┃ ┃
┃ A template to demonstrate the use of a 7-segment display,┃
┃ a single LED, a Resistor, a buzzer and an input switch. ┃
┃ ┃
┃ Copyright (c) 2024 Matthias Grimsel ┃
┃ BSZ-Radeberg, Germany ┃
┃ License: GPL ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
"""
from machine import Pin, PWM
from time import sleep
sleep(0.1)
print("Hello World!")
CONT=0
led_onboard = Pin(25, Pin.OUT)
led_red = Pin(22,Pin.OUT)
SevSegDot = Pin(2, Pin.OUT)
buzzer = PWM(Pin(19))
btn = Pin(21, Pin.IN, Pin.PULL_DOWN)
def beep(freq,vol,dur):
buzzer.freq(freq)
buzzer.duty_u16(vol)
sleep(dur)
buzzer.duty_u16(0)
while 1:
led_onboard.toggle()
if btn.value():
led_red.on()
SevSegDot.toggle()
buzzer.freq(1024)
buzzer.duty_u16(50)
sleep(0.1)
buzzer.duty_u16(0)
led_red.off()
sleep(0.1)