PID Output Problem.

Hello.

I've got a little problem with output i dont exactly know how it work.

SetPoint 0-255
Input 0-255
OutPut 0-255

double Setpoint, Input, Output;
PID myPID(&Input, &Output, &Setpoint, 2, 5, 1, DIRECT);

setup()
myPID.SetOutputLimits(-255, 255);
Input = map(analogRead(A0), 0, 1023, 0, 255);
Setpoint = 0;
myPID.SetMode(AUTOMATIC);

loop()
Setpoint = pinNumber2*2.5; // pinNumber is a value from my phone sended via ESP 0 - 255
Input = map(analogRead(A0), 0, 1023 , 0, 255);
myPID.Compute();
analogWrite(5, Output);

When i set setpoint = 150 by my phone then input take by potentiometer 140,150,144,153 cuz i dont have encoder...my output change from 0 to 255...
if i think good it should be value sth around 150 to maintain this speed or output is sth else???
Could u explain?

PS. when i set this it's working, rotate motor with speed what i want but it's not PID ;///
analogWrite(5, SetPoint);

When i set setpoint = 150 by console

Please post a complete program otherwise we don't know how you are doing this.

i send value via ESP from my phone. And it's 0 -255. The main problem is why Output have 255 value instead of sth about 150 ;/

i send value via ESP from my phone. And it's 0 -255

Via Extra Sensory Projection? No wonder it doesn't work.

Post your code or hit the road.

Problem i think solved it was my fault. When setpoint < input, output do everything what it can to make setpoint = input, so output go down very fast to -255, when setpoint > input, output go very fast up to 255, i couldnt realize from that because i adjust my input by myself not by encoder. Never mind it's working, i hope so ;D