PIR motion sensor, Arduino, Processing, not working

Without an exact problem, I can only offer sanity checks:

  • Are you able to play your video in a sketch without any serial communication, etc.?
  • Does your Arduino sketch send data to the “Serial Monitor” within the Arduino IDE?

If both of those are working, then the issue lies between receiving and decoding the serial message.
Edit: I noticed you have defined PORT_INDEX in Processing but do not use it.
Make sure to use the serial port matching your Arduino from Serial.list()

I often use a single character when sending commands over a serial interface.
You could try sending just a “Y” or “N” from the Arduino and check for those in Processing.

Also, you will likely get more people looking at your code if it is formated.
Select it and use the “</>” icon when editing

2 Likes