PID library (PWM)

Hi,

I have 2 questions about the PID controller library,

First, I'll use it for high switching MOSFET with frequency 62.5 kHz, so it's supposed to work without problems? Or I should not use it?

Second, how can I disable the D part of the controller? (setting Kd = 0?)

I'll use this basic code:

#include <PID_v1.h>

//Define Variables we'll be connecting to
double Setpoint, Input, Output;

//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);

void setup()
{
  //initialize the variables we're linked to
  Input = analogRead(0);
  Setpoint = 100;

  //turn the PID on
  myPID.SetMode(AUTOMATIC);
}

void loop()
{
  Input = analogRead(0);
  myPID.Compute();
  analogWrite(3,Output);
}

All that depends on the controlled system. So yes, you can do, at your own risk.