Matthew's Coding Blog: Musical Instrument
- mziegen
- Oct 4, 2021
- 1 min read
In this week's assignment, the objective was to create a musical instrument through coding.
I've used several jumpers, four resisters, a potentiometer, an FSR, and three LEDs to create the final product.
The most important piece here (other than the jumpers and resisters) has to be the potentiometer. This is because it determines the tempo of the beat (coming off the speaker) and displays one light at a time which depends on how far you pitch the dial-up on the potentiometer.
With the FSR, the harder you press on the pad, the stronger the sound and the higher the pitch of the note coming from the speaker becomes.
The FSR is hooked into pin2 while the potentiometer hooks up to pin1, completing the two of three analog sensors in use.
Below is the video of the project in action:
The link to the code is below:
https://makecode.microbit.org/_7qdAPD8u4ev7
Comments