Self balancing unicycle code. need help with data from PID

I have combined a program that reads my imu sensors ( sparkfun 5dof ). with a self balancing robot code by kerry wong. I am aquiring the data and i think im getting good numbers for mixing the gyro and accelerometer but my previous error and current error in the pid calculations are the same number.

I would actually go as far as saying all the PID data looks incorrect, but on the right track...

i attached my .ino file.

Thanks for looking!

gp

aramgp.ino (10.4 KB)

my previous error and current error in the pid calculations are the same number.

On line 209.

 prevErr = curErr;

thanks for looking that over!

that line is supposed to take the current error from the last calculation and make it the previous error for the next calculation.

i fixed some mistakes in the code i posted here, but i still have the currerr=preverr issue.

To see the values of the two variables "prevErr, curErr", you will need to print them before the "=" part of the code that I mentioned. You can put prints inside of the function before line 209 to debug your code. After you are able to see the output, then you can remove them or continue looking for the problem.

aaaahhh. i see. i fixed a couple other issues and im starting to get some output that makes sense.

thanks for the help.

glenn