Correct sketch for DIY H-shifter + clutch arduino Leonardo

Hello. Sorry for bad english. Want to make H-Shifter + clutch for racing games. Have a original one Arduino Leonrado. Working perfectly fine. but, i want to find a sketch, that allows me to connect one axis for clutch and 8(better be 9) buttons. There is issue: i want to put grn pin on shifter rod and put diffrent pins in shifter box to make circle. Can i do this to arduino leonardo? Cuz i was trying to find correct sketch, but i guess all they want is buttons which i have not, i want to make without them, if it's possible. I do not know how to code and other stuff, i'm just a beginner who want to race :smiley:

[UPDATE], so i do it by myself and sharing this with you guys. It has clutch( A0 pin) + 9 buttons(4 pin by 12

[UPDATE#2])sketch_aug14a.ino (3.0 КБ), that's more correct sketch, in previos one i accidently type wrong number and JoyButton4 was stuck after pressing. Now it's fine. If someone still need this sketch and im not the only one

@vanusy, your topic has been moved to a more suitable location on the forum to give it a better exposure. Not everybody will read topics in development -> libraries.

1 Like

Search for topics using Arduino + buttons. There You can find example code that You can work from.
No helper will make it for You.

A "button" is just two conductors you can touch together. You can make any two wires act like a button if you touch them together.

For an "H-Shifter" I would connect the shifter rod to Ground and have wires connected to different INPUT_PULLUP pins in the positions to be detected. When the pin reads LOW the shifter rod is touching the wire.

I already have a "working" shifter and it even working with some skecthes. But i can't map all gear's cuz of scetch in Arduino. For example, "HatSwitchTest" from "ArduinoJoystickLibrary-master" working perfectly fine, and games even work with pov#1, but don't with pov#2(in device settings it work) Sorry for my messy messages, tech eng hard for me