PWMSoundOutput
Last updated
Was this helpful?
Last updated
Was this helpful?
This example shows how to use the PWMOut
to generate notes. It plays three tones repeatedly.
SwiftIO board
Jumper wires
Buzzer
SwiftIO shield (optional)
The code above uses a Frequency as musical pitches. For example, NOTE_C4 is middle C, whose frequency is 262 Hz. Latter example MidiPlayer we will markdown all this musical note in a file. This file contains all the pitch values for typical notes. You may find it useful whenever you want to make musical notes.
- The PWMOut class is used to change the time of high voltage during one period to simulate different output.