I don't have any experience writing code, and I'm trying to program a thumbstick to control two servos for aiming a pneumatic cannon. I've run into the problem that the servos center with the thumbstick (as they follow the thumbstick's movements, which centers when you let go of it). I have no idea what code I should add to stop this from happening, and I was wondering if anyone could help me fix this. I have attached my code to this post. If anyone could give me an example as to what instructions I should add to this code, I'd be very grateful.
That's what is supposed to happen. The servos follow the thumbstick/joystick position. If it centres so do they.
If you want to move the servos to a position and then stay in that position until you decide to fire you could use another switch, perhaps a "hold" switch", to say that. Otherwise how will the program know when the servos are supposed to follow the stick movement and when not?