My Project Website

Coding

What I did

For this project, I was first handed a 4 x 4 keypad that I could experiment with before implementing the code into my project. This was my first time coding a keypad or even using a switch statement to this extent. I was previously taught how to use a switch statement but have never used it so it was a first for me when I used it for this project. I first when online and looked for how to code the DFplayer mini and found this which I used as a basis of my code. I then used the LED I used in previous coding projects found here and made it so that when I pressed a button, a combination of the LEDs will light up. This allowed me to know that it was working. Initially, I tried implementing it so that when I pressed a pushbutton, it will change to a new set of light combinations which worked initially but could not be controlled like in Assignment 12 found here and so I decided to remove the button from the project. This is the result of my testing and its code.

After making sure the coding could work, I changed the coding to work with the DFplayer mini. I then got a friend to play some piano keys and record them for me. Afterwards, I changed the audio files in the SD card to the piano key audios so that I could play Megalovania. Although the audio sounded soft when the speaker was not in the box, it was audible when in the box. Though it has to be noted that even though the note sounded correct when played on the computer, it did not sound like the note its supposed to be when played through the speaker. The circuit and code is shown below.

circuit

I then removed the Arduino Uno and replaced it with an Arduino Nano that I slotted into the breadboard. However, due to a lack of forethinking, I had already glued down the casing and platforms and am unable to take a picture of the circuit. But I am proud to note that the circuit still works after transfering the wires and code over. I also added in a power socket onto the circuit so I can power the launchpad with a 5V power supply.