Hi guys,
I'm working with a PID sketch and I want to setup trigger points for different PID settings depending on how far the input is from the setpoint.
The original code for this section looks like this and it works fine...
double gap = abs(Setpoint-Input); //distance away from setpoint
if(gap<10)
{ //we're close to setpoint, use conservative tuning parameters
myPID.SetTunings(consKp, consKi, consKd);
}
else
{
//we're far from setpoint, use aggressive tuning parameters
myPID.SetTunings(aggKp, aggKi, aggKd);
}
However, I want finer control so I came up with this, but it does not work.
Cabinet.cpp: In function 'void loop()':
Cabinet:109: error: expected primary-expression before '<' token
Cabinet:113: error: expected primary-expression before '<' token
if(gap <= .5){
seedHTxch.SetTunings(UconsKp, UconsKi, UconsKd);
}
if(gap > .5 && < 1){
seedHTxch.SetTunings(consKp, consKi, consKd);
}
if(gap >= 1 && < 2)
{
seedHTxch.SetTunings(aggKp, aggKi, aggKd);
}
if(gap >= 2)
{
seedHTxch.SetTunings(UaggKp, UaggKi, UaggKd);
}
I've tried all I can think of and used the reference guide to try and find the proper commands but nothing I can come up with works.
Please help
Thanks!