tag:blogger.com,1999:blog-18654210.post40261562841010717..comments2023-08-16T09:09:14.719-05:00Comments on Programming Ponderings: Arduino Joystick LibraryMatthew Heironimushttp://www.blogger.com/profile/12240009124919899377noreply@blogger.comBlogger88125tag:blogger.com,1999:blog-18654210.post-12848137592485261072023-06-01T17:05:07.569-05:002023-06-01T17:05:07.569-05:00This comment has been removed by the author.yazan barghouthhttps://www.blogger.com/profile/07882073270986748023noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-83417551428380610732022-05-05T01:58:29.395-05:002022-05-05T01:58:29.395-05:00Hi Matt, I would use this sketch for my Home Cockp...Hi Matt, I would use this sketch for my Home Cockpit that I use with MFS2020 or Xplane11, but I have a problem if I use a switch button.<br />if I connect a switch to the arduino micro and assign a function of the flight simulator to this switch (for example taxi light) I see that if I lower the lever of the real switch even in the simulator the lever of the taxi light is lowered, when I raise up the lever of the switch real, the simulated one does not react, it stays down.<br />If I lower the real one again, the simulated one finally gets up.<br />In other words, the virtual lever reacts to every two commands of the real one.<br />There is a way for solve this problem?<br />Thanks and ciaoMiohttps://www.blogger.com/profile/02920277095897986307noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-46030534349574284692021-12-27T19:55:01.822-06:002021-12-27T19:55:01.822-06:00I have not added feedback functionality to my libr...I have not added feedback functionality to my library yet, but others have. See https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary for an example.Matthew Heironimushttps://www.blogger.com/profile/07191794082144849963noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-54969844175505554052021-12-27T12:33:12.741-06:002021-12-27T12:33:12.741-06:00Hi Matt,
Than you for this very useful resource. ...Hi Matt,<br /><br />Than you for this very useful resource. I have a question, I have a joystick with feedback (my own custom design). What can be done to receive feedback from the game to arduino, so it then can control joystick feedback?<br /><br />Thanks<br />Henry<br />Henryhttps://www.blogger.com/profile/00137327375924322735noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-39296065745332571302021-10-11T14:10:35.918-05:002021-10-11T14:10:35.918-05:00Hi Matthew,
I have set up a single enco...Hi Matthew,<br /> I have set up a single encoder on a Leonardo and it is working fine according to Serial Monitor. My problem is that despite Joystick showing in Control Panel as gamepad/joystick, showing in Windows 10 joy.cpl and showing in my flight simulator calibration tool the encoder does not activate any of the test buttons or axes.<br /><br />I had issues at first loading single joystick link, but did a new install of Arduino and it then worked.<br /><br />The encoder is 3 pin wired to Pin 2 & 3 and ground as per encoder wiring instructions.<br />Any ideas would be welcome. I am on latest Arduino and your latest code.<br /><br />Thanks<br />Robert.Robertfmhttps://www.blogger.com/profile/17095517725435954163noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-11566269261472712452021-07-15T16:40:12.706-05:002021-07-15T16:40:12.706-05:00Been playing with this over the week, works really...Been playing with this over the week, works really well. Only I might be over looking something, and I'm hoping some can help clarify.<br />It says it has X, Y, and Z axis aswell as X, Y, and Z axis rotation and a Rudder & Throttle Axis.<br />So that's 8 axis?<br />However in the picture and in my tests I can only ever get 7 axis. X & Y, Z, X & Y Rot, Rudder & Throttle. Z Rot doesnt show up in the controllers settings. Is there something I am missing? <br />Anonymoushttps://www.blogger.com/profile/16693567710136831588noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-18576225198559527062021-06-29T10:05:29.131-05:002021-06-29T10:05:29.131-05:00Absolutely brilliant library! Thank you so much fo...Absolutely brilliant library! Thank you so much for your work Matthew, it is truly appreciated.Anonymoushttps://www.blogger.com/profile/14906463116567229744noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-8511996067972964442021-02-10T04:44:13.447-06:002021-02-10T04:44:13.447-06:00This Library is amazing, thank you! If it helps, I...This Library is amazing, thank you! If it helps, I rejigged the GamePad example a little to make it easier to customise. I added Pin-to Button assignments on a per button basis and should allow the setup of a gamepad with relative ease. :-)<br /><br />https://github.com/jamhamster/12-Button-Arduino-GamepadJamHamsterhttps://www.blogger.com/profile/00920914348136663563noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-52901066013321273012020-11-06T08:25:29.767-06:002020-11-06T08:25:29.767-06:00Dear Matthew!
I managed to use it as wheel now wi...Dear Matthew!<br /><br />I managed to use it as wheel now with my temporary butto solution, and if I don't include x axis just steering it shows the steering, but something strange as value jumps from left to right withut calibration.<br /><br />I can only use steering if I run windows calibration wizard, but I am sure there could be some range which works without calibration.<br />I tried it with 0-1023 range and with 0-300 range as on your example with Joystick.setSteeringRange(0, 300);<br />and mapping 0-1024 to that intervall still no default calibrated center.<br />My wheel is centered at center range of the resolution as simple potentiometer.<br />Any solution to be able to pre-calibrate it so be plug and play with ranges windows likes?<br /><br />Thanks!<br /><br />p.s.: I could only try the lib on my old win7 computer win10 recognized leonardo as Android device not arduino :( also win7 shows this lonardo as unknown with this new library version but as I have an xbox360 controller I can reach the advanced setting as dialog is the same then I can select Leonardo for setting and calibration, but no game controller device icon for this leonardo, a bit strange but I am not soo lucky with IT :)<br /><br />Foto Amghttps://www.blogger.com/profile/12641610895665499843noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-6795970269383334142020-11-06T03:20:44.750-06:002020-11-06T03:20:44.750-06:00Dear Matthew!
Thanks for the reply!
I dig deeper ...Dear Matthew!<br /><br />Thanks for the reply!<br />I dig deeper and I hope those will be solved soon.<br />At the current state with my actual steering wheel conversion I've got a bit of challenge so need some days to test your suggestions.<br /><br />Bt until that I have an other question you might help with.<br />I don't plan to use interrupts or send the state only when it is changed to the lib but simply using 'delay' in my loop and send actual state frequently.<br />How small/big delay is optimal for udpdating the state and sending sendstate so to communicate with the PC?<br />I think it is not good having very small delay in loop like delay(30) as there will be lots of data sent by the lib might not good for PC too, what is your experience?<br />Of course too big delay also would not be good to be able to control the game :)<br />I have lots of analog reading and conversion so have time for sure already consumed in my loop.<br /><br /><br />(It is out of scope here but I can share my current challenge: The wheel I am converting has not normal push buttons but soft rubber buttons having 8k resistance upressed for each button and work like an analog input when pushed in it reduces it sresistance until 3k and pushed harder to near 0ohm so I cannot make voltagge ladder to use one analog input for lots of buttons.<br />I have to buy io extender, replace buttons or only use 1 analog inptut for 2 buttons so more wires less ports free. Life is not that simple here :))<br /><br />Thanks!Foto Amghttps://www.blogger.com/profile/12641610895665499843noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-63365841825467825122020-11-01T07:34:05.371-06:002020-11-01T07:34:05.371-06:001 - Try using the includeBrake and includeSteering...1 - Try using the includeBrake and includeSteering options and the setSteering and setBrake methods. See https://github.com/MHeironimus/ArduinoJoystickLibrary for more details.<br />2 - You have to send at least one value to the host PC before it can know the value of the joystick. You can try sending an initial value to the host PC after you initialize the library and see if that helps your issue.Matthew Heironimushttps://www.blogger.com/profile/07191794082144849963noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-59671436918655908862020-11-01T03:21:06.503-06:002020-11-01T03:21:06.503-06:00Hi!
I am using this lib for my Yoke system, works...Hi!<br /><br />I am using this lib for my Yoke system, works weel, I only have 2 issue so far, maybe someone could help:<br />1) how to recognize it as a driving wheel, so instead of X/ Y axis rotation the wndows setting page should show wheel rotation?<br />2) maybe it is not the libs failure and it is for any game controllers in wondos, but it does not show the correct throttle value until I change it.<br />So I have to push throttle each time startig the game or connecting device, canot leave it as set for a good neutral throttle for example for airplane start....<br /><br />How to overcome those small issues?Ű<br />Thanks for the lib and tutorial!Foto Amghttps://www.blogger.com/profile/12641610895665499843noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-50264266213622983972020-11-01T03:20:37.236-06:002020-11-01T03:20:37.236-06:00Hi!
I am using this lib for my Yoke system, works...Hi!<br /><br />I am using this lib for my Yoke system, works weel, I only have 2 issue so far, maybe someone could help:<br />1) how to recognize it as a driving wheel, so instead of X/ Y axis rotation the wndows setting page should show wheel rotation?<br />2) maybe it is not the libs failure and it is for any game controllers in wondos, but it does not show the correct throttle value until I change it.<br />So I have to push throttle each time startig the game or connecting device, canot leave it as set for a good neutral throttle for example for airplane start....<br /><br />How to overcome those small issues?Ű<br />Thanks for the lib and tutorial!Foto Amghttps://www.blogger.com/profile/12641610895665499843noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-72295930833259180252019-11-14T08:04:55.853-06:002019-11-14T08:04:55.853-06:00Hello Matthew,
I am currently building a collecti...Hello Matthew,<br /><br />I am currently building a collective for a helicopter controller. I use an Arduino Leonardo board for this. I need: 7 axes, 2 Hut switches and about 20 switches.<br /><br />The programming of the Hut switches has now been achieved with the help of someone else on the Web. See http://hc625ma.org/ab412-collective-head/?unapproved=1379&moderation-hash=4156039c4b5a180d4a684babcb44afe5#comment-1379<br /><br />I can also program the axes, but without problems I can program a 7th axis on e.g. pin 4?<br />Because of this I have 13 pins left for the switches. Is it possible to apply a button matrix (eg 4x5) in the same sketch? Possibly by using keypad.h Labrary? This means that 2 libraries are used!<br /><br />I look forward to your response.<br />FerFer Goosenhttps://www.blogger.com/profile/01839162833209372849noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-28991392896328367962019-11-14T08:03:50.486-06:002019-11-14T08:03:50.486-06:00Hello Matthew,
I am currently building a collecti...Hello Matthew,<br /><br />I am currently building a collective for a helicopter controller. I use an Arduino Leonardo board for this. I need: 7 axes, 2 Hut switches and about 20 switches.<br /><br />The programming of the Hut switches has now been achieved with the help of someone else on the Web. See http://hc625ma.org/ab412-collective-head/?unapproved=1379&moderation-hash=4156039c4b5a180d4a684babcb44afe5#comment-1379<br /><br />I can also program the axes, but without problems I can program a 7th axis on e.g. pin 4?<br />Because of this I have 13 pins left for the switches. Is it possible to apply a button matrix (eg 4x5) in the same sketch? Possibly by using keypad.h Labrary? This means that 2 libraries are used!<br /><br />I look forward to your response.<br />FerFer Goosenhttps://www.blogger.com/profile/01839162833209372849noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-60959577111865292722019-08-02T20:03:24.631-05:002019-08-02T20:03:24.631-05:00Hi Matthew - I noticed you have not responded for ...Hi Matthew - I noticed you have not responded for over a year so I hope all is well with you ?<br /><br />My problem is that I am a sim racer and not a fabricator or programmer :(<br />I have copied a sketch (from here : https://www.thingiverse.com/thing:3043797 ) to use a wii fitboard load cell, HX711 loadcell amp and Arduino Pro Micro to use the loadcell as a brake.<br /><br />When I compile and upload the sketch it works fine and I can do a calibrate from IDE and can see the value rising from 0 to over 30,000 with a lot of pressure on the loadcell.<br /><br />But when I try to calibrate it in Windows or in my game (Assetto Corsa) it goes from 0 to +32767 by just touching it. Its like an on/off switch :(<br /><br />I have nothing else added to the Arduino board, so no buttons or anything else.<br /><br />Any ideas ?<br /><br />Thanks<br />KenKenhttps://www.blogger.com/profile/15997423416254530561noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-56003077943539497352019-05-27T16:04:28.475-05:002019-05-27T16:04:28.475-05:00Hi,
I just wanted to say thanks.
I dropped this ...Hi,<br /><br />I just wanted to say thanks.<br /><br />I dropped this library in and I now have a 20 button controller that I can use in Elite Dangerous. From a coding perspective this took about 10 minutes, the physical build much longer :)<br /><br />However, I am acutely aware that your library is doing all the heavy-lifting here and I just wanted to say thanks for putting in the time and effort.<br /><br />All the best,<br /><br />Gareth.Garethhttps://www.blogger.com/profile/15106553485640578765noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-82709370623271576352019-05-12T17:12:48.456-05:002019-05-12T17:12:48.456-05:00Hi,
This library is very interesting but it is al...Hi,<br /><br />This library is very interesting but it is also a bit difficult to understand how this library actually works. Is there any tutorials which help us to get used to with this library?<br /><br />Furthermore I would like to know does this library work with this kind of eBay device which I just bought happily without truly knowing that is it possible to use with this library? <br /><br />The link to this joystick is here: https://www.ebay.com/itm/Black-Joystick-Potentiometer-JH-D202X-R2-R4-5K-10K%CE%A9-2Axis-Sealed-PTZ-Thermistor/223506698426?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m2749.l2649<br /><br />The model of this joystick is : Black Joystick Potentiometer JH-D202X-R2/R4 5K 10KΩ 2Axis Sealed PTZ Thermistor<br /><br />There are plenty of these examples at the market. So I think that it is important that this library could potentially work with this device too. It seems to be very simple joystick based on the potentiometers having one fire button. <br /><br />My plans are such that I will modify this joystick heavily to suit my needs. I will 3D model a decent stick for it and a base etc. in order to have a good flight stick with Elite Dangerous. It will then be 3D printed all this stuff. <br /><br />But I need some help in order to make all this. I have no clue how to define different buttons with this library, how to define potentiometer based joystick with it etc. This seems to be a very unique style of library which is not nice for a new learner. <br /><br />Anyway it is good and best to notice that it works nicely with win 10 as a gaming device all this if and only if the library is fully understood. <br /><br />Please help me if you can and have time Matthew.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18654210.post-53778540295998941742019-05-04T11:46:30.584-05:002019-05-04T11:46:30.584-05:00I was wondering if there is a way to turn off cont...I was wondering if there is a way to turn off controller emulation when a button is pressed, I have attempted this with Joystick.end() but can't get it to do anything at all. Any help would be greatly appreciated, the Joystick library is really nice!HectorBarthttps://www.blogger.com/profile/18329898198431037288noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-74656399616559021232018-07-08T21:43:35.864-05:002018-07-08T21:43:35.864-05:00@Matthew Heironimus - Thanks for the info and the ...@Matthew Heironimus - Thanks for the info and the fast response. I'll see what I can accomplish with just 8 axis.Kiel Peasehttps://www.blogger.com/profile/11894239840634118125noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-62484651453838138662018-06-25T06:25:57.569-05:002018-06-25T06:25:57.569-05:00@Kiel Pease - I think eight is the maximum number ...@Kiel Pease - I think eight is the maximum number of axis supported by the standard USB driver. I think if you want to get over 8, you would need to write a custom USB driver for your OS. You would also need an application that knew how to read over 8 axis.<br /><br />More details: https://github.com/MHeironimus/ArduinoJoystickLibrary/issues/60<br />http://www.usb.org/developers/hidpage/HID1_11.pdfMatthew Heironimushttps://www.blogger.com/profile/07191794082144849963noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-8178268671402970002018-06-23T01:27:50.297-05:002018-06-23T01:27:50.297-05:00This library is great!
How would I go about usin...This library is great! <br /><br />How would I go about using JOYSTICK_TYPE_MULTI_AXIS if I wanted to map out 8-10 different axis? I plan on having more that 4 thumbsticks to 1 arduino as 1 joystick. It seems that the library is only set up for 2 axis (or 4 is you utilize the '.setZAxis' setttings). My apologies if my wording isn't correct, I'm very new to this. Thanks!Kiel Peasehttps://www.blogger.com/profile/11894239840634118125noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-54269118484670258852018-04-27T09:01:36.649-05:002018-04-27T09:01:36.649-05:00I would love to give this a try, however I'm a...I would <b>love</b> to give this a try, however I'm a proud owner of a Teensy++ 2.0.<br />Is there any chance to get the same thing done for the AT90USB1286 too?<br /><br />Cheers!<br />MikeStorebrorhttps://www.blogger.com/profile/14928810077632654993noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-67749581999191784192018-04-19T14:12:44.714-05:002018-04-19T14:12:44.714-05:00Hi, thanks for your work, I am very new, how can I...Hi, thanks for your work, I am very new, how can I add more buttons to gamepad example, thank you very much.Anonymoushttps://www.blogger.com/profile/12981042326584602765noreply@blogger.comtag:blogger.com,1999:blog-18654210.post-31632424268490869642018-01-09T07:25:56.112-06:002018-01-09T07:25:56.112-06:00Hi Matthew,
I cannot get my Pro Micro to appear a...Hi Matthew,<br /><br />I cannot get my Pro Micro to appear as a game controller no matter what I do. I've even tried loading the v2 joystick libraries on to it. It's compiles fine but just appears as a keyboard and mouse. Very annoying to say the least.Anonymoushttps://www.blogger.com/profile/10595570154700717593noreply@blogger.com