Finished Code
Since our project is finished and we have posted videos of the module working, we want to share our code to give a deeper view of how it works.
MIDI Keyboard
Figure 1 demonstrates how we imported the promidi library which allowed the MIDI input to be used in Processing. It also assigns ports for the MIDI keyboard input and Arduino output.
![]() |
Figure 1: Importing promidi library and assigning ports |
Determining Notes
Since our sonochromatic light depends on the note, and there are multiple keys of each note on the keyboard (one for each octave), we need to make sure the same output will come from pressing two different keys of the same note. Figure 2 takes each key and assigns it to a certain note. The note will be a number 1-12, for A,B,C,D,E,F,G,A#,C#,D#,F#,G#. (Not in that order)
![]() |
Figure 2:Assigning each key to a specific note |
Arduino
Once we have the input from the MIDI keyboard, we have to get the Arduino to communicate with the LED pins in the breadboard. Figure 3 demonstrates how the code is set up to prepare the RGB LEDs to recieve an input
![]() |
Figure 4: RGB color output for each note |
No comments:
Post a Comment