Joystick Servo Control Issues
Hi,
I am trying to have my esp read the x and y values from a joystick input, and I have got that down I believe based on the serial monitor.
I am having issues when I am trying to connect servos to the circuit.
I posted my code above, and I’m not sure if it’s the code or the hardware but something isn’t right.
The first problem that i noticed is when I connect the joystick to the 5v source as it says to do on the part, the resting value goes to like 120° instead of 90° at rest for both the x and the y axis. I was able to figure this out and the problem was that the inputs for the esp only can read up to 3.3v so when I switched the source from 5v to 3.3v I then got the proper resting value of 90°. (I am putting this in for context incase this is an issue since the joystick does say it needs 5v)
The main problem is that the servos are EXTREMELY twitchy randomly. I have included some code screenshots where the x and y values jump around by 10°-20° after I move one servo a little. The y servo responds almost perfectly to the joystick inputs but the x barely moves and if it does move it is very twitchy. I posted a video with the serial monitor and the servos acting weird above.
The servos are connected to a 5v source and gnd each and have their own output.
I have researched online and asked chat gpt for help but I still haven’t found a solution. I want to understand what is wrong with my code/setup so I don’t make this mistake again. Please let me know if you see a problem or know what is going on!!! Thank you! I also have no idea how to use GitHub so I just put the code in the beginning of the video.