简单的使用例子,也有高级模式 库在最后 /******************************************************** * PID Basic Example * Reading analog input 0 to control analog PWM output 3 ********************************************************/
#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;