ducted fan one degree of freedom attitude control

hello I am an student from iran an i am sorry for my english.
i have a project and i send you the picture of my ducted fan stand
i want to control the attitude of this duct to the zero state
i want to write the PID alguritm in arduino.
i write some thing but i think it is so wrong
I know I shoud find the gains of PID.I want to write this alguritm and then use thrial and Error method to find this cofficient
i woud be so grateful to answer me as soon as possibel for you.

Image Guide
That looks like two degrees of freedom with two servos. Do you have them linked together?

Code on paper cannot be proved to be wrong. Try writing it as an Arduino sketch and insert it into your reply with [ code ] tags. Read the post on how to use this forum.

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks..Tom.... :slight_smile: