Добрый день темы про подключения двух стиков не нашёл, задам вопрос здесь.
Дано:
1) 2 джойстика Quick Shot подключение через game port (на ось X/Y по ползонкувому потенциометру (в исходном виде работали как реостат) + 2 кнопки)
2) Аналог Arduino Leonardo
образцом взят скетч от ждойстика для авиасимулятора. В котором используется стик и два потенциометра (из кода для этих потенциометров в коде описаны как RZ и (на 100% на уверен но скорее всего РУД), хотелось бы сделать второй стик) и 3 кнопки.
С добавлением 4-ой кнопки разобрался
Проект: Эмуляция оператора экскаватора для игрушки Gold Rush
Непосредственно код (потенциометры на пинах А3 и А2):
//Define and Allocate Input Pins to memorable names
#define joyX A0
#define joyY A1
#define joyRZ A3
#define joyThrottle A2
#define joyButton1 9
#define joyButton2 8
#define joyButton3 7
#define joyButton4 6
//Initializing Axis as Integers, at a 0 default value
int xAxis_ = 0;
int yAxis_ = 0;
int rzAxis_ = 0;
int throttle_ = 0;
//Setting up Buttons
//Updating a static variable gives greater stability than reading directly from the digital pin.
//Giving Default Values to the Buttons for later use
int lastButton1State = 0;
int lastButton2State = 0;
int lastButton3State = 0;
//Defining the Joystick
//The Joystick is defined in the following setup:
//Joystick(Joystick HID ID, Joystick Type, Button Count, Hat Switch Count, Include X, Include Y, Include Z, Include Rx, Include Ry, Include Rz, Include Rudder, Include Throttle, Include Accelerator, Include Brake, Include Steering
//Joystick HID ID: A Hex value identifier for HID Device Recognition (default: 0x03). DO NOT USE 0x01 or 0x02
//Joystick type: Define the type of joystick from the types supported. Types: DEFAULT Joystick (0x04 or JOYSTICK_TYPE_JOYSTICK), Gamepad (0x05 or JOYSTICK_TYPE_GAMEPAD), Multi-Axis Controller (0x08 or JOYSTICK_TYPE_MULTI_AXIS)
//Button Count: Number of Buttons shown to HID system (default: 32)
//Hat Switch Count: Number of Hat Switches, max 2. (default:2) Здесь вроде как говорится, что 2 переключателя шляпы
//Include X Axis: Determines whether the X axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Y Axis: Determines whether the Y axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Z Axis: Determines whether the Z axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Rx Axis: Determines whether the X Rotational axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Ry Axis: Determines whether the Y Rotational axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Rz Axis: Determines whether the Z Rotational axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Rudder: Determines whether a Rudder axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Throttle: Determines whether a Throttle axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Accelerator: Determines whether an Accelerator axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Brake: Determines whether a Brake axis is avalible for used by the HID system, defined as a bool value (default:true)
//Include Steering: Determines whether a Steering axis is avalible for used by the HID system, defined as a bool value (default:true)
Подскажите/помогите как прописать второй джойстик как стик.
P.S Заранее благодарю. С уважением Денис.