you can use the example you linked above, but you have to put
mySerial = new Serial(this, detected_port, 9600);
inside the if-statement at the end of the code, and not separate in the draw() loop.
the last if-statement will only run if a new device actually has been found.