MHeironimus / ArduinoJoystickLibrary

An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.
GNU Lesser General Public License v3.0
2.07k stars 403 forks source link

Legs map / mapping #155

Closed CryptoAngel closed 3 years ago

CryptoAngel commented 3 years ago

Hi,

Why A0 is ground, isn't "ground" suppose to be? Can you see the picture attached, why isn't it working?

I tried it with the Flight Controller

Regards IMG_7985

MHeironimus commented 3 years ago

I am sorry. I do not understand the question.

CryptoAngel commented 3 years ago

How to connect the analog potentiometer for flight joystick?

MHeironimus commented 3 years ago

You will need to connect the X axis and Y axis outputs of your stick to analog inputs on the Arduino. You will then need to read those values in using the analogRead function and sent the results to the PC via the Arduino Joystick library's setXAxis or setYAxis functions. Which pins you actually use is based on how you write your sketch file.

CryptoAngel commented 3 years ago

I'm using your example with your library. you stated that ground suppose to be A0 but you can see on the picture I uploaded there's dedicated "ground" on the Leonardo board. The wiring on the picture is not correct?

MHeironimus commented 3 years ago

I think you have misunderstood the purpose of the FlightControllerTest example. It is not an example of how to make your own Flight Controller (with real hardware). It is a test script verifying the functionality of the Joystick library. Grounding A0 causes the test script to execute (or pause if you let the A0 pin float high). You will need to write your own sketch file to accomplish what you are trying to do.

CryptoAngel commented 3 years ago

Do you have an example code for Joystick that use your library with analog XY and digital button and maybe hat?

MHeironimus commented 3 years ago

A list of example projects people had done with the library has recently been added to the wiki (https://github.com/MHeironimus/ArduinoJoystickLibrary/wiki/Examples).