p5 sketch: https://editor.p5js.org/zqyoiv/sketches/A7voScnBa
Learning: how to debug serial communication:
- order of coding:
- code arduino, open serial monitor, send msg to arduino port from the serial monitor to make sure arduino side is correct
- close serial monitor (important, only one application can take over the port at one time)
- code p5, send msg to arduino, make sure msg format(binary/ASCII) is consistent between p5 and arduino, see hardware reaction.
- Note: the long side of LED is positive