forked from sbcshop/Raspberry-Pi-Pico-Breadboard-Kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPicoBreadboard.py
39 lines (30 loc) · 980 Bytes
/
PicoBreadboard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from machine import Pin,PWM
from utime import sleep
#class to control onboard LED
class LED():
def __init__(self, led_pin_number):
self.led_pin = Pin(led_pin_number, Pin.OUT)
def on(self):
self.led_pin.on()
def off(self):
self.led_pin.off()
# class to control Buzzer
class BUZZER():
def __init__(self,buzzer_pin_number):
self.buzzer_pin = Pin(buzzer_pin_number, Pin.OUT)
def on(self):
self.buzzer_pin.on()
def off(self):
self.buzzer_pin.off()
# class to read onboard Buttons value
class BUTTON():
def __init__(self, button_pin_number):
"""Initialize BUTTON.
"""
self.button_pin = Pin(button_pin_number, Pin.IN)
def read(self):
""" provides button status value
-> 0 (for Not Pressed)
-> 1 (for Pressed)
"""
return self.button_pin.value()