CrowPi Christmas special project!

Roni   2018/12/24   CrowPi Christmas special project!已关闭评论

As Christmas is coming, we at Elecrow cannot forget even for a moment our hard effort during the year on working on our CrowPi, from sketching an idea to a reality of successful Kick-starter campaign!

We decided to celebrate this Christmas with a special xmas special project using the CrowPi!
We all know that during Christmas there is nothing better than sitting under the tree with the entire family and singing Christmas songs, why sing alone when you can have a melody singing for you?
Our special project will allow your CrowPi to “sing” some Christmas songs for you using the on-board buzzer.

We’ve already created an example that can be found here:
https://github.com/Elecrow-keen/CrowPi/blob/master/Misc/xmas_special.py

Let’s go step by step to see how we’ve made it so you could make your own as well!

The first step will be to go to this website: https://www.extramaster.net/tools/midiToArduino/
This website can convert .midi files to both Raspberry Pi GPIO code or Arduino code! This will eliminate the hard process of trying to figure out the tones and the notes for the song you’re trying to play.

You will need to find your own midi file, there are many online. Try googling “your_favourite_song_here.midi” to find a midi file of your song.

In our example, we used the following song: https://bit.ly/2A2obqh

Make sure to use the upload button as the option with attaching link inside the website seems to have some troubles, if attaching a link doesn’t work for you – uploading a file will work!

After finding your midi file, it’s time to use the website to get a code ready!
Don’t worry if it states for “Arduino” at the bottom of the link you will see that you can checkbox “Raspberry Pi” box.

In the track box make sure to check “Piano”, it can be any number but in our example it’s TrackChoose a track

 

 

 

 

 

 

In the bottom of the page you’ll find a form called “Device” make sure to tick “Raspberry Pi (Python, GPIO) as we are going to make it work for our CrowPi.

choose device

 

 

 

 

 

 

After this step it’s time to convert our midi track into python code using this button:
convert_midi

 

 

 

 

 

 

Even tho the button states “Convert midi to Arduino” it will work just fine with Raspberry Pi if you checked the box states” Raspberry Pi” one step before.

After pressing the button your code will be ready and converted successfully into readable python code. Copy the entire content and save it into .py file.

code is ready

 

 

 

 

 

 

 

 

 

One last thing will be to change “tonePin = 21” into our buzzer pin, change it to “tonePin = 12”.

Copy the file into your CrowPi and execute it using the command “Python your_file_name.py” and your CrowPi should be able to sing xmas song right now!