Finalized concept for the project;
Even though I was unsettled at first I finally decided to go with the color matching game where the user observes random color patterns on p5js and tries to match them by pressing the same sequence of colors on a set of push buttons embedded on a wooden platform.
Communication between p5js and arduino;
The communication between p5js and arduino begins with a handshake which is initialized by the library we used in class – p5-web-serial(). The p5js generates random colors in increasing sequence and waits for response from the arduino. Arduino sends feedback in terms of the color that has been pressed if it is green for instance,… the p5 reads the serial which has the color pressed in arduino printed out. If the color read matches with the expected color then p5js reads it as correct and proceeds to the next round. If not, the p5js reads it as wrong and repeats the same sequence. For multiple colors in a long sequence the arduino prints out the colors pressed in an array that is matched against that which has been displayed in p5js. And the same logic of checking for correctness is repeated.
Images of progress