This week, I controlled the random background color and banana count of my p5 MIDI sketch with one push button.
My original idea was to use two push buttons to control the color and banana.
So, when I press one button, I wanted to change the background color of the sketch, and when I press the other button, I wanted to add a banana continuously and fall down to the ground. However, I did not figure out the code for putting two different inputs in WebMidi.inputs; in my p5 sketch. It was also difficult to find out the code for the specific midi messages – ie 61, 62, 63, 64, and 65.
So I just controlled the minion’s background and bananas simultaneously in ‘WebMidi.inputs;’ in p5 with just one pushbutton + arduino nano 33 IOT.
How do I make the code in p5.js and Arduino to control changes differently with two or multiple push buttons?
This is the circuit:
This is the final output: