Tips to create a deadzone for Arduino game controller joystick.h

Hi i am creating a game controller using arduino leonardo i maped the joystick and i have a problem every time i enter a game my camera just points to the ground (goes up) and the reading is right on the middle and i think if i add a deadzone it may fix it i dont know the code i have for the joysticks is : //ROTATION AXIS X=A0 AXIS Y=A1 Joystick.setXAxisRotation(map(analogRead(A0),0, 1024, 0, 360)); Joystick.setYAxisRotation(359-map(analogRead(A1),0, 1024, 0, 360));
(359-map(analogRead(A1),0, 1024, 0, 360)); 359-map. because i dont know why but Y Axis is inverted. I am Portuguese so sorry for the bad english

(post deleted by author)

i think if i add a deadzone it may fix it

What you describe doesn't sound at all like a deadzone woukd solve you problem.

Do you know what a deadzone is in this context?

If so, why do you think it would help?

Perhaps you are using the wrong term for something you think is the answer.

Draw a graph of what the joystick output should be… angle of the joystick on one axis and the value you'd like to read on the other, then we can see what you might really mean.

a7

for example the joystick on the y axis has a value from 0% to 100% when it is in neutral position it is supposed to be at 50% but on mine it is at 48% so I thought it was a deadzone like in the PS4 or XBOX controllers that could solve the problem.

a deadzone that says that any value within that area is 50% I don't know if I made myself understood I don't know if it's even possible to program this so I'm asking for help to know if it's possible if it is how can I do it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.