The Air Piano pairs music with electronic circuits to create this beautiful thing.How to build it
And I add two buttons to increase and decrease the octave, then I defined a fixed topology in this project to configure all the modules.
Now time to generate individualized source code for each module bcased on its location in the array. Click on Manage Project Items and add seven targets if they're not already there.Choose each module from the dropdown menu and click on "Options for Target". Modify _module=1 in the "C/C++" tab into module number (1 to 7) and modify the name of the executable in the "Output" tab to match module number as well. Click on Batch Build >> Select All >> Rebuild.
After that I wrote the code for IR range sensor module (H08R60) I define BosVar to transfer the level of octave to each module to send the right message to Audio Speaker Module (H07R30) to play the note.
Then we increase and decrease this variable using button, after that we send the message to make the speaker module play the right note.
Each module has its unique note to play it from seven notes in musical scale as we see in this video below.