PID Example 1


can I replace the analog INPUT and OUTPUT to degital ? How?
How can equate a long variable to double?


  • PID Simple Example
  • Reading analog input 0 to control analog PWM output 3

#include <PID_Beta6.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);

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

//turn the PID on

void loop()
Input = analogRead(0);

Thanx in advance,

thnx for replying,

sorry for crossposting, they weren't supposed to have the same questions. I just forgot to remove the first question.