In this lesson we learn about PWM (pulse width modulation) a technology for generating Square waves that can be passed into electronic components.
PWM allows you to dim LEDS, and play tones through passive buzzers such as the KPM-1205A or the ABT- 402-RC as demonstrated in this project.
This project will allow you to recreate any song, you can work out the notes and timing too.
We will use circuit python which you can download from
Pi Pico
https://circuitpython.org/board/raspb...
Pi Pico W
https://circuitpython.org/board/raspb...
You can download the notes data from my own website at www.ckenthusiast.com
and finally we have a list of pre-prepared star wars notes you can find below:
song = [
notes.note["C4"], 1,
notes.note["G4"], 1,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.25,
notes.note["C5"], 1,
notes.note["G4"], 0.5,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.25,
notes.note["C5"], 1,
notes.note["G4"], 0.5,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["F4"], 0.25,
notes.note["D4"], 1,
notes.note["G4"], 0.5,
1, 0.01,
notes.note["G4"], 0.5,
notes.note["C4"], 1,
notes.note["G4"], 1,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.25,
notes.note["C5"], 1,
notes.note["G4"], 0.5,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.25,
notes.note["C5"], 1,
notes.note["G4"], 0.5,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["F4"], 0.25,
notes.note["D4"], 1,
notes.note["G4"], 0.5,
1, 0.01,
notes.note["G4"], 0.5,
notes.note["A4"], 1,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.25,
notes.note["C4"], 0.25,
1, 0.01,
notes.note["C4"], 0.25,
notes.note["D4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.2,
notes.note["A5"], 0.2,
notes.note["B5"], 0.2,
notes.note["G4"], 0.5,
1, 0.01,
notes.note["G4"], 0.5,
notes.note["A5"], 1,
notes.note["F4"], 0.25,
notes.note["E4"], 0.25,
notes.note["D4"], 0.25,
notes.note["C4"], 0.25,
notes.note["G4"], 1,
notes.note["D4"], 2,
notes.note["G4"], 1,
]