Two PID Controller on one Arduino uno???

Hello!

Is it possible to insert 2 PID controllers in one Sketch for a Arduino uno Port?

MFG
Wolfgang

(deleted)

Hi,

Please anyone tell me what I am doing wrong.
I am trying to read via serial monitor the values of Input, Setpoint and Output of the basic example from the PID library.
I would like to see how these values change, but it’s being complicated.
Do I have to connect the input and output together? Put 5 Volts in somewhere?

/********************************************************
 * 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;

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

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

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

I am trying to read via serial monitor the

If you mean "read from" the serial monitor, you ought to have some calls to Serial.begin(), Serial.available() and Serial.read() in your code.

If you mean "write to" the serial monitor, you ought to have some calls to Serial.begin(), Serial.print() and Serial.println() in your code.

I would like to see how these values change, but it's being complicated.

Hogwash. It's dirt simple.

Do I have to connect the input and output together?

The input and output of what?

Put 5 Volts in somewhere?

Somewhere, yes.

What are you reading from? What are you trying to control? What does the code ACTUALLY do? How do you KNOW whether it is working, or not?

I did the calls like 'Serial.begin(9600); Serial.println(Input);' etc..

Let's say I want to use change this code to control the brightness of a LED and write to serial monitor. Where does the LED go? What is going to be my input?

Thanks!