In this example, an Arduino, wired as shown in Figures 1 and 2 below, sends values from a potentiometer and a pushbutton serially to the p5.serialcontrol app. It uses the Arduino_JSON library to format the serial output as JSON. The code can be found at this link. This sketch reads from the app via a websocket, using the p5.serialport library.
When the knob or the pushbutton changes signficantly, their values are sent serially as a JSON string. The sketch reads this string, parses it, and uses the values to set the values of the button and slider above.