Because it's analog, You will need two analog looking at pins with your microcontroller to determine X and Y. Obtaining an extra electronic input will Permit you to examine the switch. This code reads the analog values from the joystick's X and Y pins, converts them into corresponding voltage values, https://arcadejoystick46801.blogadvize.com/46270650/5-easy-facts-about-diy-arcade-parts-described