Lab: Two-Way (Duplex) Serial Communication Using An Arduino and the p5.webserial Library
https://itp.nyu.edu/physcomp/labs/labs-serial-communication/lab-two-way-duplex-webserial-communication/

Two way of Asynchronous: Binary & ASCII
ceive the data in P5.js

Code is correct



Flow Control: Call and Response (Handshaking)

Question: How a closed p5.js effect a running arduino?