Because it's analog, you'll need two analog reading pins in your microcontroller to find out X and Y. Owning an additional digital enter will Allow you to read through the change. This code reads the analog values from a joystick's X and Y pins, converts them into corresponding voltage values, https://deborahx358srp8.thebindingwiki.com/user