Arduino Joystick Library PPM channel mapping

I want to use the Flysky FS-I6 for FPV of a drone simulator through a radio receiver and arduino. But I can't figure out which channel needs to be mapped to where? channel 3 (i.e. the throttle) is it the z axis or the throttle after all? and other channels are also not clear to me which channel is responsible for the x,y,z axis. and how to map additional channels (5-8, switches) as buttons or as "HatSwitch"


  switch(ch) {
    case 2:
    Joystick.setXAxis(value*255 - 127);
    break;

    case 3:
    Joystick.setThrottle(value*255);
    break;

    case 1:
    Joystick.setYAxis(value*255 - 127);
    break;

    case 4:
    Joystick.setHatSwitchRyAxis(value*360);
    break;

    case 5:
    // Joystick.setHatSwitch(value*255 - 127);    
    break;

    case 6:
    // Joystick.setRudder(value*255);    
    break; 

    case 7:
      break; 

    case 8:
      break;
  }

source code say:

    // Set Axis Values
    void setXAxis(int32_t value);
    void setYAxis(int32_t value);
    void setZAxis(int32_t value);
    void setRxAxis(int32_t value);
    void setRyAxis(int32_t value);
    void setRzAxis(int32_t value);

    // Set Simulation Values
    void setRudder(int32_t value);
    void setThrottle(int32_t value);
    void setAccelerator(int32_t value);
    void setBrake(int32_t value);
    void setSteering(int32_t value);

    void setButton(uint8_t button, uint8_t value);
    void pressButton(uint8_t button);
    void releaseButton(uint8_t button);

    void setHatSwitch(int8_t hatSwitch, int16_t value);

please explain what exactly it says? I've seen it all before, but it didn't make it any clearer to me. and my questions are still relevant, channel 1(2,3,4) is which axis? is the throttle channel a throttle or some kind of axle?

this are axes. you know what your FlySky contain and how it is programmed. for example you has throttle on left stick and up/down left/right on the right stick + 1 button. PPM channels(still for example) 1/2 - xAxis/yAxis:

  case 1:
    Joystick.setXAxis(value*255);
    break;
  case 2:
    Joystick.setYAxis(value*255);
    break;

channel 3 trottle:

  case 3:
    Joystick.setThrottle(value*255);
    break;

channel 4 button:

  case 4:
    Joystick.setButton(0,value>0.5?1:0);
    break;

and than on PC it should be so:
изображение
actually i don't know how you config Joystick object, so property window on PC may vary.

provide full sketch.

Maybe Dronebotworkshop video can give you clues...

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