Issues with reading numbers from serial port
The problem here is that Serial.parseInt() stops when it sees the
newline, but it does not consume that newline, which is left in the
input buffer. Thus, at the next loop iteration, Serial.available()
returns true because of this newline and, unless you send another value
fast enough, Serial.parseInt() times out and returns zero.

The easy fix is to consume that newline yourself:

void loop() {
  if (Serial.available()){
    setpoint = Serial.parseInt();
    if (Serial.peek() == '\n') Serial.read();  // consume LF
    Serial.print("Set to: ");
    Serial.println(setpoint);
  }
}


I personally would not use Serial.parseInt() at all, and would buffer
the data myself until I see the '\n'. This way there are
no surprises with timeouts being read as zero.