Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently working on a quadcopter in which I want help in setting up my PID.

I am trying to get output from the PID loop by giving input from MPU6050's (accelerometer and gyro) pitch value. The pitch value from the MPU6050 is given to PID loop, but I am not getting any output from the loop. I have set the setpoint as 0, and the output from the MPU6050 ranges between -90 to +90(this is the PID input).

My code for PID:

float input, output, setpoint=0;

PID* myPID(&input, &output, &setpoint, 2, 5, 1, REVERSE); 
myPID.compute();

Then I am printing the output values but am getting only 0 whatever the input from MPU6050.

share|improve this question
2  
can you add a working (but minimal) example of an full sketch demonstrating the problem? – BrettAM Feb 4 '15 at 6:55
    
Is the gyro for sure outputting accurate data? – Anonymous Penguin Feb 4 '15 at 16:52
    
yes, i am using the arduino sketch from the mpu6050 library, which uses the DMP to process the data – Jenish J Feb 5 '15 at 9:41
1  
is the * in PID* a typo? Otherwise these lines of code shouldn't even compile. – BrettAM Feb 5 '15 at 20:12
    
The code is a part of Arduino sketch, and not the complete code – Jenish J Feb 7 '15 at 7:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.