Different behaviour between Processing and Arduino Serial Monitor

There is a problem, that I have run into, and was the issue in this topic. I found the problem using RPi talking to a Chinese Arduino Mega. If you send to the Arduino serial when it’s not ready, the serial is messed up and doesn’t work. When you connect to it with your Processing sketch, that resets the Arduino, and then there’s a period when it’s not ready. So try waiting two seconds after connecting before sending any serial characters. That might be too long, but see if it fixes the problems, then reduce. I’ve never seen this problem with Arduino Uno or Nano, but suspect it’s there on Mega and Due.

Now there’s another problem with ControlP5 might be active here. This topic says that when you create a CP5 button it runs its action. In your case this might be sending serial to a not-ready-Arduino.