Jukebox Assignment
- colleenguirand1
- Sep 26, 2021
- 1 min read
In this project, I decided to keep it simple by implementing two different button for two sounds. First, I started by setting both my variables to zero indicating that none of the buttons should have a value of 1 or should be pressed in the beginning of the project. Also, I added a string that only plays in the beginning to prompt user to play with microbit. Then, I set each variable to a specific pin, in this case pin 1 and 2. Then I said, if bP1(button press 1) is equal to 1 or is on, turn the led light on, show a string of characters and play a sound. The same was repeated for the second variable and in the buttons aren't pressed then they will be off.
Some difficulties I faced was when I was trying to get the music to play only once. I chose the option to keep it running once, but it kept going only to find out it was because I had a greater than sign instead of an equal sign in my comparison block. Before I realized my mistake, I grabbed a "when pin 1 button pressed" block and inserted the sound, which worked well. Also, I am still trying to figure out how to make the light interchange as the music plays.
Hozzászólások