I'm still kind of lost and dont understand your question but if you ment which part of the code do the analog part for the joystick here is the old versionnicky1664 wrote: ↑Thu May 18, 2017 7:26 amClearly, I would like to know with your configuration, as a function of the push on the joystick you can walk or run inside of the video game like Mario 64.
Code: Select all
int rX = analogRead(4);
rX = (rX - 512) * 1.5 + 512;
if (rX > 1023)
rX=1023;
if (rX < 0)
rX = 0;
int rY = analogRead(5);
rY = (rY - 512) * 1.5 + 512;
if (rY > 1023)
rY=1023;
if (rY < 0)
rY = 0;
rY=abs(1023-rY);
int rL = analogRead(0);
rL = (rL - 512) * 1.5 + 512;
if (rL > 1023)
rL=1023;
if (rL < 0)
rL = 0;
int rR = analogRead(1);
rR = (rR - 512) * 1.5 + 512;
if (rR > 1023)
rR=1023;
if (rR < 0)
rR = 0;
//rR=abs(1023-rR);
Joystick.X(rX);
Joystick.Y(rY);
Joystick.sliderLeft(rL);
Joystick.sliderRight(rR);
Code: Select all
Joystick.X(map(analogRead(LEFT_HOR),215, 795, 0, 1023));
Joystick.Y(map(analogRead(LEFT_VER),235, 855, 1023, 0));
Joystick.sliderLeft(map(analogRead(RIGHT_HOR),210, 805, 1023, 0));
Joystick.sliderRight(map(analogRead(RIGHT_VER),195, 805, 0, 1023));