-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
112 lines (109 loc) · 1 KB
/
main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
from machine import Pin, PWM
import utime
E7 = 2637
F7 = 2794
C7 = 2093
G7 = 3136
G6 = 1568
E6 = 1319
A6 = 1760
B6 = 1976
AS6 = 1865
A7 = 3520
D7 = 2349
signal_intake = Pin(15, Pin.IN, Pin.PULL_DOWN)
output = Pin(0, Pin.OUT)
buzzer = PWM(output)
buzzer.duty_u16(0)
buzzer.freq(300)
mario = [
E7,
E7,
0,
E7,
0,
C7,
E7,
0,
G7,
0,
0,
0,
G6,
0,
0,
0,
C7,
0,
0,
G6,
0,
0,
E6,
0,
0,
A6,
0,
B6,
0,
AS6,
A6,
0,
G6,
E7,
0,
G7,
A7,
0,
F7,
G7,
0,
E7,
0,
C7,
D7,
B6,
0,
0,
C7,
0,
0,
G6,
0,
0,
E6,
0,
0,
A6,
0,
B6,
0,
AS6,
A6,
0,
G6,
E7,
0,
G7,
A7,
0,
F7,
G7,
0,
E7,
0,
C7,
D7,
B6,
0,
0,
]
while True:
if signal_intake.value() == 1:
for i in mario:
if i == 0:
buzzer.duty_u16(0)
else:
buzzer.freq(i)
buzzer.duty_u16(32768)
utime.sleep(0.15)