Lab: Two Way Duplex Communication
Lab Link: https://itp.nyu.edu/physcomp/labs/labs-serial-communication/lab-two-way-duplex-webserial-communication/
PComp Lab: https://editor.p5js.org/ajt521/sketches/dUEBc6m-E
I begin by wiring up the breadboard with one push button connected to digital pin 2 and two potentiometers to A0 and A0 analog inputs.
I proceed to upload the provided code and get the appropriate reading in the serial monitor. The button and potentiometers are both reading out.
Now time to receive the data in p5, beginning with the WebSerial code and setup code.
I setup the code as instructed but cannot get the data from Arduino IDE to p5. The Web Serial connection looks correct as far as I can tell. I inspect the sketch code and the HTML code and cannot figure out where my problem is. When I put console.log in the serialEvent function, it will not show any data in the console.
With some help from Yeseul I realized the data wasn't sending to p5 because my serial monitor was open! Here is the working program.