Musical Instrument
- colleenguirand1
- Oct 3, 2021
- 1 min read
In this project, I decided to create a musical instrument using LEDS, analogs, Booleans, digital input/output and conditions. The first thing I did was set both my variables "light" and "force" to 0, which lets the microbit know that both need to be off at start. The light variable indicates how much light is hitting the pentiometer and force is to indicate how hard the black flask pin is pinched.
Then, I separated both variables into their own pins and created conditions for light. If the light was higher than 800, digital pin 5 would light up an LED and 8/11 would be off. Same rule applied for the other pins.
In order to hear sound, I attached the speaker to the ground button and pin 0 and depending on which way the nozzle turns, it determines how fast the beat goes.
Unfortunately, only the first half of the project work because when I turned the nozzle, the other LEDs should turn on and off.
https://makecode.microbit.org/_d6g2sdiY9Eqi
Comments