Setup and test on Aruido when not connecting to p5.js.
Connecting to p5.js
Then I open the serial control and the p5 web editor to make the connection between Arduino and P5.js. In the p5 sketch, I changed back the functions regarding the server connection status to console.log, letting the status appear in the console tab.
As shown in the video, I can control the location of the white ball using the potentiometer. The ball's color will ideally change when I press the button, but now it is not so obvious.
Code for Arduino for the handshaking part.
Testing on Arduino only without p5 connection. When opening the idle, text "hello" appears repeatedly. The data can be accessed when typing something in the textbox.