Erratic Joystick (yoke) inputs using Ard. Leonardo

Dear all,

I'm trying to get my yoke pots work properly with my simulator build. I'm using arduino Leonardo's Analog pins as it this board simulates a HID device by itself.

I'm really new to programming and probably my code sucks, as I wrote it from a couple references found somewhere on internet

problem is, whenever I send an input to the simulator the input does not stay constant i.e: full left does make a left bank all they way to the end but it wont remain constant it after a short period of time it goes neutral. same problem with the elevator pot

*been trying to calibrate the yoke several times with both Win and the sim software (fsx) via FSUIPC
Could this be an electrical problem?
there's obviously a better way to program what I want, any help is more than welcome


*note: I modified my Logitech Saitek Pro Yoke to work with Leonardo Board since the original Mobo is really bad at reading pots and causes lots of deadzones.

here is the code I'm using:

#include "Joystick.h"

  true, true, true, true, true, true,
  true, true, true, true, false);
int Throttle = A0;
int ThrottleValue;
int Percent;

int Prop = A1;
int PropValue;
int Percent1;

int Mixture = A2;
int MixtureValue;
int Percent2;

int Joy1 = A4;
int Joy1Val;
int Joy1Valy;
int Percent3;

int Joy2 = A3;
int Joy2Val;
int Joy2Valy;
int Percent4;

   //initialize joystick
void setup() {
  Serial.begin(9600); //inicia serial en 9600
Joystick.begin();     //inicia joystick


void loop() {

   const bool initAutoSendState = true; 

   ThrottleValue = analogRead(A0); // valor de throttle es igual a lectura pot a0
   Percent = map(ThrottleValue,0,1023,0,255); 
    delay(50); //delay de 0.1 seg
    Serial.println(Percent); // monitor mapping prop descomentar 

 // Serial.println(Percent1); // monitor mapping prop descomentar 

  // PropValue = analogRead(A1); // valor Prop es igual valor pot a1
   Percent1 = map(PropValue, 0,1023,127,-127);
    delay(100); //delay de 0.1 seg 

   MixtureValue = analogRead(A2); // Valor Mixture es igual a valor pot a2
   Percent2 = map(MixtureValue,-511,511,0,255);
   delay(50); //delay de 0.1 seg  
  // Serial.println(Percent2); // monitor mapping prop descomentar 

    Joy1Val = analogRead(A3); //valor joy1 es igual a valor a3
    Percent3 = map(Joy1Val,1023,0,255,0);
//  Serial.println(Percent3); 

    Joy1Valy = analogRead(A4);
    Percent4 = map(Joy1Valy,1023,0,255,0);

     // Serial.println(Percent4); // monitor mapping prop descomentar 

Are you constantly/consistently sending the same value to the PC over and over?

If you press a key on the keyboard... and let go, it only does this (prints) once.. you have to keep it down so it constantly sends the key value over and over...

I believe it is. at least it does show constant inputs from the pots when I use the serial monitor

Not to sure how this would work as different joysticks or yokes have different communication protocols or different voltage level requiring logic level shifters so how would that all work

it's just regular 20k pots acting as X & Y Axis, could this be an electrical issue?

thing is I remember changing something on the code that worked fine once..

what does "const bool initAutoSendState = true;" ?

i'm running out of ideas here