Hello Guys,
I'm trying to creat a PID controller for my inverting Buck boost converter , I'm facing alot of errors wjile programing and I have no idea what to chance ,I need HELP!,I've attached my code :
int potentiometer = A0;
int feedback = A1;
int PWM = 3;
int pwm = 0;
int analogPin = 0;
//Define Variables we'll be connecting to
double Setpoint, Input, Output;
//Specify the links and initial tuning parameters
double kp=1, ki=.4, kd=0;
//PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
PID::PID(double* Input, double* Output, double* Setpoint,double Kp, double Ki, double Kd, int DIRECT)
void compute(){
unsigned long previousMillis(); //How long since we last calculated*
double timeChange = (double)(now - lastTime);
}
void setup() {
// put your setup code here, to run once:
pinMode(potentiometer, INPUT);
pinMode(feedback, INPUT);
pinMode(PWM, OUTPUT);
analogWrite(PWM,120);
//initialize the variables we're linked to
Input = analogRead(analogPin);//turn the PID on
myPID.SetMode(AUTOMATIC);
myPID.SetOutputLimits(0,255);
}
void loop() {
// put your main code here, to run repeatedly:
Input = analogRead(analogPin); // read the input pin
myPID.Compute();
analogWrite(PWM, output);
}
}
try_4_PID.ino (1.05 KB)