Arduino Joystick 2.0 Library - Beginners Guide

  Рет қаралды 90,953

Dan's Tech Box

Dan's Tech Box

Күн бұрын

Пікірлер: 223
@CRJ700
@CRJ700 2 жыл бұрын
I have decided that YOU are one of my favorite people in the entire world! Not just because you've got that cool accent thing going on, but because you posted something useful that went straight to the point. Thank you for saving me TONS time by posting this tutorial. It is VERY appreciated!
@Johan-ex5yj
@Johan-ex5yj 3 жыл бұрын
This is an excellent tutorial, thank you. 👍 One possible improvement is to add the following in the setup section >> Joystick.setXAxisRange(0, 255); Joystick.setYAxisRange(0, 255); Joystick.setRzAxisRange(0, 255); Joystick.setThrottleRange(0, 255); That ensures that you get full range output, with no need to calibrate.
@CapungPlastik
@CapungPlastik 3 жыл бұрын
what's the different using "range" and map?
@Johan-ex5yj
@Johan-ex5yj 3 жыл бұрын
@@CapungPlastik In this example the guy is mapping the normal 10 bit analog range of 0 to 1023 to 0 to 255, because he wants the resolution to be bigger (less sensitive). The Joystick library, expects (by default) that the numbers will be 0 to 1023, so you will end up with a Joystick that has only 25% of if it’s full travel. That is why you need to specify that your range is 0 to 255. If however, you use the full 0 to 1023 resolution, you don’t need set the range, and you also do not need to do any mapping. In this case the range command is still useful if you need to invert an axis, then you go: …Range(1023, 0) instead of …Range(0, 1023) .
@SynisterGatess07
@SynisterGatess07 11 ай бұрын
i ve been looking the whole day for an in depth tutorial and finally found exactly what i needed. thanks
@ZachJackson-ri6lf
@ZachJackson-ri6lf 7 ай бұрын
Thank you so much for this video, I have now successfully built my own flight sim Hotas complete with rudder pedals, a handbrake for racing, 2 joysticks for Farm / Construction Sim, and now a one handed controller / keyboard hybrid, and NONE of them would've worked if i hadn't found your video.
@avm263
@avm263 Жыл бұрын
Thankyou so much my dude! I just bought my leonardo after realising I wasn't able to do this with an uno, but didn't know where to go from there. I have some basic coding with arduino but felt really helpless after finding out about this library, your video helped me so much!!! Have a great day sir.
@nocloo6829
@nocloo6829 10 ай бұрын
Thanks for this very straightforward tutorial! I am new to Arduino and programming and was looking for exactly what you explained. I had been able to read out a potentiometer with arduino and I played around with Hieronymus' examples, but I could not figure out how to merge the two. Thanks to you, I am so much closer to creating my own flight sim peripherals!
@spencer.h561
@spencer.h561 2 жыл бұрын
I’ve been looking for this for so long, this is exactly what I need. I am trying to start making and selling flight simulator equipment and this knowledge is going to be extremely helpful!
@santiagoluib3
@santiagoluib3 5 күн бұрын
You are a God-Send bro! The past 2 weeks I have been looking for this and here you are. Thank you so much for sharing this excellent tutorial. A Sub and a Like you deserve!
@zooknut
@zooknut Ай бұрын
Thank you, finally an instructional video that helped unlock all 18 digital pins on my Pro Micro and understand why things get done the way they do.
@mirochlebovec6586
@mirochlebovec6586 8 ай бұрын
This probably the most comprehensive guide for this library.
@nigelb5370
@nigelb5370 3 жыл бұрын
Many, many, thanks for this tutorial and example code. It was precisely what I needed for my simple DIY button box/potentiometer throttle. I would have been trying to figure out the 'right' code for months if I hadn't found your excellent video. As it was, I was able to program my Arduino in less than ten minutes and it worked perfectly first time.
@arturkonczalski
@arturkonczalski 5 ай бұрын
Your first video that i watch, and already love it. Straight to the point. Solved all my issues with joystick.h. Cheers!
@mheironimus
@mheironimus 4 жыл бұрын
Thanks for posting this video.
@blurry_craft
@blurry_craft 3 жыл бұрын
8 data is dat mean it just have 0 to 255 step/precision n how could it has 16bit precision without have latency so much sir?
@the_arrgyle9086
@the_arrgyle9086 3 жыл бұрын
THANK YOU! Made my first DIY Throttle yesterday. Out of an Arduino, Lego, some Wires, Hotglue, Rubber Bands, Hockey Tape and Ziplocks ;-)
@SantaGamerYoutube
@SantaGamerYoutube 3 жыл бұрын
Legos! Haha great
@garethbarry3825
@garethbarry3825 3 ай бұрын
Just one thing for anyone who-like me- comes here to use this tutorial to build a joystick or button box - the 'ResponsiveAnalogueRead' library is incredibly useful - it helps get rid of the 'jitter' that is often a problem with potentiometers and other analogue inputs. The examples in the library itself show quite clearly how to implement it.
@Magpie...
@Magpie... 24 күн бұрын
Oh mate, I've been tearing my hair out trying to get hall sensors to work well. I hope this does it!
@garethbarry3825
@garethbarry3825 24 күн бұрын
@Magpie... give it a try (responsiveanalogRead), it made a HUGE difference for me! Also, try to make sure that the power supply is as stable as possible-if you look at the power cable to something like a thrustmaster joystick, there is often a ferrite ring, which is also get rid of any noise on the power line. Try using shielded cable from the arduino to the hall sensor signal pin, with the actual shield (the mesh wire around the signal wire) grounded on one end. Another thing that can help is a small capacitor from the power pin to ground to act as a low pass filter. I feel your pain- it took me ages to get the hall sensors in my home-made throttle to work well. In the end, the responsiveanalogRead library fixed the problem completely, without having to use shielded wire etc. Have you tested that you are getting nicely changing values on the serial monitor when you move the sensor relative to the magnetic field? Let me know is there is anything I can help with- i hope you have success!
@garethbarry3825
@garethbarry3825 24 күн бұрын
@Magpie... i typed out a reply which got deleted for some reason, but, as well as ResponsiveAnalogRead, you can also 1. Use shielded wire from the signal pin of the hall sensor to the arduino. Make sure that the actual shield is grounded on one end. 2. A small capacitor between V+ and ground to help smoothen the voltahe supply. 3. A small capacitor from the signal wire to ground. Note; both 2 and 3 act as low-pass filters to smoothen and stabilise a voltage. The larger the capacitor value, the heavier the filtering. Im sure that ResponsiveAnalogRead will go a long way towards solving your problem
@Magpie...
@Magpie... 24 күн бұрын
@@garethbarry3825 Thanks, I have shielded wires and some capacitors in the mail already but I think it will be nice to have the software to fall back on if they fail!
@garethbarry3825
@garethbarry3825 23 күн бұрын
@@Magpie... please let me know if you have success- best of luck
@manch.gamingrodri8089
@manch.gamingrodri8089 3 жыл бұрын
Enormous thanks for the tutorial and amazing work explaining it, I really didn’t understood the examples of the library and this helped me a ton
@Chef_PC
@Chef_PC Жыл бұрын
Just this one video has helped me immensely to get my button box going. Thanks!
@tonipaskalin6973
@tonipaskalin6973 3 жыл бұрын
You made my life so much easier, thank you so much for making this video.
@colins2
@colins2 3 жыл бұрын
Excellent, thanks for posting. I've just built a set of rudder pedals and now need to connect then up, so this tutorial was perfect.
@jmsian3505
@jmsian3505 2 жыл бұрын
20:01 changing Arduino Name. Thanks for this!
@jeffonquest1001
@jeffonquest1001 3 жыл бұрын
Finally someone that explains it all!
@StraitRazr
@StraitRazr Ай бұрын
Found this video today. Thank you!
@garethbarry3825
@garethbarry3825 Жыл бұрын
Incredibly useful and clear - thank you so much for this.
@nvennep111
@nvennep111 5 ай бұрын
I do not react or like KZbin videos regularly, but wow, what a great video! Thanks for you help!!
@abirmahato648
@abirmahato648 8 ай бұрын
best one out there. hats off man, this is amazing. I have been trying to do this myself for so long. thanks for the help man.
@garytaylor5646
@garytaylor5646 3 жыл бұрын
I just have to say "" Thank you"", I have spent weeks searching KZbin for your video :) After many headaches of going through Arduino courses etc., I can now do this for my flight sim, totally enjoyed your no waisted info talk, please do more for us old simmers that are not electronics guys but really want to build our sims that work,
@danstechbox7077
@danstechbox7077 3 жыл бұрын
Thanks Gary! I plan on doing some vidoes on the basic concepts of arduino and sim controls, but just started a new job so squeezing it in when I can :)
@davidfleminguxo
@davidfleminguxo 2 ай бұрын
@@danstechbox7077can you squeeze those in now?
@SkyriderOfficial
@SkyriderOfficial Жыл бұрын
Most valuable tutorial on the topic. Thanks!!!🎉🎉
@vanusy
@vanusy 3 жыл бұрын
Thank you sooooo much. I don't know c++ at all and get my first leonardo, but with your guide i sucsessfully make my own sketch for my purpose. Thank you very much
@eugenebrown9803
@eugenebrown9803 3 жыл бұрын
waiting on your more complex teachings
@BokeFlyingSimulations
@BokeFlyingSimulations 2 жыл бұрын
this is an A MA ZING tutorial man. Congratulations, it is VERY helpful!
@NortheastLance
@NortheastLance 3 жыл бұрын
Dude this was great. It got me started and taught me a bit. Now i gotta figure out how to make a toggle switch act like a button
@BushidoShishido
@BushidoShishido 3 жыл бұрын
Please let me know if you ever figure that out!
@triodit
@triodit Жыл бұрын
Thank you so much! Your a legend and I'm SOOOOO referancing this in my design documentation!
@davekelly4322
@davekelly4322 Жыл бұрын
Just what I needed. Thanks a lot
@Joejoe-vd2do
@Joejoe-vd2do 3 жыл бұрын
I wish I could've liked this video more than once!
@astonishing-a
@astonishing-a 9 ай бұрын
Legend, Thanks for this!
@hakanviajando
@hakanviajando 3 жыл бұрын
Thank you very much for the greatly detailed video.
@tbryson2
@tbryson2 3 жыл бұрын
Thank you for taking the time to present this! It's exactly what I've been looking for! One question though, when you were calibrating the axis, the visual indication was jumping all over the place! Obviously it didn't affect the outcome, but is that normal and / or something to "worry" about? Will that same jumping around be evident while using the Arduino as a joystick controller?
@cosmicp.o.m.e3460
@cosmicp.o.m.e3460 3 жыл бұрын
Thanks for confirming what I was afraid of misunderstanding :Thumbs UP: :)
@SwoodyCraft
@SwoodyCraft Жыл бұрын
Excellent tut. Thank you
@konrad4680
@konrad4680 3 ай бұрын
Big thanks bro😍🙏🏻🙏🏻✊🏻
@requiem4adreamc
@requiem4adreamc Жыл бұрын
Very detailed and informative video. Thank you very much :) I am gonna make an button box and diy analog handbrake. I hope i can manage to do them :)
@johanns.rivera3480
@johanns.rivera3480 Жыл бұрын
it says that I have downloaded the library and it shows in my library folders but i get an error message saying there is so such file as joystick .h
@sudipthapa9877
@sudipthapa9877 3 жыл бұрын
You are my god bro wow ❤️❤️❤️ ,thank you very very much dude much appreciated.
@sirnewhill
@sirnewhill 3 жыл бұрын
Thanks, this video was very helpful!
@dmmuller
@dmmuller 2 жыл бұрын
Thanks for taking the time to make this video and explain the steps thoroughly. Did you ever complete the button matrix version at all?
@Nikolas_A
@Nikolas_A Жыл бұрын
I run the multiple joystick example. It enumerates four joysticks (all named Arduino Micro). Is there a way to name each separately? E.g. Joystick1, Joystick2 etc
@felipeyoshino6951
@felipeyoshino6951 3 жыл бұрын
Easiest like I've ever gave in a video
@casperhxr6018
@casperhxr6018 2 жыл бұрын
Very helpful, thank you!
@ChainsawDNA
@ChainsawDNA 2 жыл бұрын
Excellent tutorial!
@danw5996
@danw5996 Жыл бұрын
Thanks for this!
@Marcin79W
@Marcin79W 3 жыл бұрын
Thank you, big help!
@tannimkyraxx
@tannimkyraxx 3 жыл бұрын
The Mega and Uno can be flashed to report as HID, but it takes a bit of extra steps and the unojoy library is a little more limited
@fernank017
@fernank017 2 жыл бұрын
i've been trying to figure this out, how would I go about it?
@amrosero
@amrosero 2 жыл бұрын
Hi, I can get a Unojoy device with Mega and Uno, but can you personalize the setup, (Name of HID in PC)?
@arias80rp10
@arias80rp10 Жыл бұрын
Fernan, u should save all that effort and hours u will spend on that, and just buy any board tih atmega32u4 like leonardo or yue @@fernank017
@Linrox
@Linrox 6 ай бұрын
Very helpful video. Can you show how to use a toggle (on-off) switch as a button.
@ProgramAndNectar
@ProgramAndNectar 3 жыл бұрын
this works! thank you!
@chethy7353
@chethy7353 4 жыл бұрын
very helpful bro
@ashleydavis2431
@ashleydavis2431 9 күн бұрын
thank you so much
@yeloyoung9944
@yeloyoung9944 2 жыл бұрын
how can we integrated a bluetooth module on it?
@vahida6146
@vahida6146 11 ай бұрын
Did you find any answer for this question?
@alessandromarrone5355
@alessandromarrone5355 3 жыл бұрын
thanks for this video that's was very helpful.....can you use distance from ultrasonic sensors as button imput?
@PuuTV
@PuuTV 3 жыл бұрын
Amazing video, shame you only have 55 subscribers.
@MegaBrettlee
@MegaBrettlee 2 жыл бұрын
hey there great vid one question i had i need two throttles do i just label them as throttle 1 and throttle 2
@seanhaynes8758
@seanhaynes8758 4 ай бұрын
Now that was a brilliant video - unfortunately I still cant get around my problem, so hoping you can give me a pointer? So I have a 6 point rotary switch. Between the output pins on the switch I have soldered 2k resisters, so each time it is switched a different voltage is set sent to the Leonardo. So the 6 outputs use only one pin on the card. Though I can create a sketch that tests the serial output to monitor, I can't figure out how to incorporate it into a joystick - is it a zRotation like your slidders? Is it seen a a single switch or many?
@oldladmanmp4
@oldladmanmp4 4 ай бұрын
i cant figure out the potentiometers... It refuses to detect the pots i wired in. have you had any luck?
@hridaanshugusain474
@hridaanshugusain474 3 жыл бұрын
why does it 'JOYSTICK_TYPE_JOYSTICK' was not declared in this scope as an error when i run my code?
@rimson3274
@rimson3274 3 жыл бұрын
i had a same problem
@hridaanshugusain474
@hridaanshugusain474 3 жыл бұрын
@@rimson3274 apparently i had the wrong library installed. after installing the correct library it worked.
@rimson3274
@rimson3274 3 жыл бұрын
@@hridaanshugusain474 303 / 5000 Wyniki tłumaczenia I suspect it too, I can not find the old library but I see that it exists, I just uninstalled the arduino program and reinstalled so that all old libraries were removed, and I suspect that it will work because it probably includes the old library with the same name, I will check it right away, but thanks , Greetings
@rimson3274
@rimson3274 3 жыл бұрын
all fine and working, thank u, have a nice day!
@LockDCS
@LockDCS 3 жыл бұрын
Awesome video. Once you program the board, can you still reprogram it with the IDE if the USB controller still thinks it is a Joystick?
@agenchicken
@agenchicken 4 жыл бұрын
Nice video man good job and ty for helping us! If I can ask you if you can explain how the steering and brake work and how we can use this library for making a steering wheel and if I can. Ty for everything and also you have a really nice voice!
@danstechbox7077
@danstechbox7077 4 жыл бұрын
Thanks for the complement! I do actually do some voice work at times! As for your question, thats fairly straight forward. Instead of defining the Axis as X,Y, Rz, and Throttle as I did in the video, you can define the axis as any of the avalible in Windows HID, as shown in the avalible axis when you define your joystick (I have them listed out in the example code in the description). In your case, you could make a pedal set using Accelerator and Brake as Axis, with possibly a Digital Button for a Clutch (depending on your use case), and then using the Steering Axis for the steering wheel - really depends on how complicated you want your setup to be. The reason you would use the Steering, Brake, and Accelerator axis as opposed to just using an X and Y axis on seperate physical units (such as two potentiometers) is that Windows joins these two together - the Steering, Brake, and Accelerator axis are reserved axis, and are seperated in the HID system so they dont have any dependancies on eachother. While most games can seperate them, there is no guaruntee as different generational implementations of the HID system can get veeeery messy, so it is better to approach it correctly from the HID controller end to avoid any overlaps in the HID software and game decoding. You can pretty much use any potentiometer, or even magnets and Hall-Effect sensors (Will be doing another video on that now my 3D printer is working again), to give you an analog input, however you will need to add a hardware return device (such as a spring or something) to make sure it goes back to reading the middle of the axis, however there are some deadzone tools in both the Windows HID setup and the Joystick 2.0 library (I think) to enable a wider middle section if you cant get an exact centre and find your wheels/rudder/other steering device is slightly leaning when it should be central. This is something I would like to approach in another video with my own Joystick and Flight Control system, but I'm still designing that so in the meantime that should give you a good idea of what to consider when designing/building your own steering wheel and possibly pedal set. You can also make digital buttons work as analog axis at 100% using some clever coding, which I will do in another video shortly, if you want to have a button on the steering wheel for brake but dont want to use a digital button, and would rather use the Brake Axis - but that depends more on how you're building your steering wheel and what games/software you want to use it on. Hope that answers your question well enough, but let me know if you have any more specific questions or would like me to clarify anything.
@agenchicken
@agenchicken 4 жыл бұрын
@@danstechbox7077 Yeah ty for all of the information is really helpful but I have 1 more question I have no problem with the steering wheel and pedals with an optical encoder and potentiometers but the strange thing is in the game f1 2020. I have a very hard time setting the controls and sometimes it does not even detect it. but in the game Asseto corsa I have no such problems and it's working wonderfully. If you have any idea why it's doing that its going to be amazing ty again for the help. Also, I want to have force feedback and I have found a joystick library similar to that one but I am not sure how the schematics go and what should I do if you can help me it will be amazing. This is the library github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary
@Kerson-f7w
@Kerson-f7w Жыл бұрын
Hello, thanks you, but can you help me with rotation x and rotation y, I can't to turn on them
@johnpeters5906
@johnpeters5906 3 жыл бұрын
Thank you very much, I'am so glad ;) that I have found this video. You did a very good job. I'am going to look for other tutorials. Question; why is it "Up to 2 Hat Switches", has this to do with the number of pins ?.
@gobdav
@gobdav 2 жыл бұрын
Thank you. Finally got my switches to work as button. How would I wire/program a 3 position switch (on/off/on) using this code?
@JoePCP
@JoePCP 2 жыл бұрын
I would also like to commend you on such an informative and interesting video. I have used your sketch quite sucessfully for my flight deck but have come up against the issue you mentioned, where more than onbe board is used. I.E. they both addess the same buttons. I've followed your description at the end of the video and for the most part undertand what should be done. However the boards.txt file in my system already includes descriptions of a number of diferent boards, should I add the data to my existing boads file or replace it with the one you provided? Also should I just change the product ID or both the vendor and product ID? Sorry to burden you with this but my 77 year old brain is not as quick as it used to be. Regards Joe.
@RedPixels_
@RedPixels_ 3 жыл бұрын
Thanks so much for the tutorial, so useful! I just have one problem: in the Arduino folder there is no "hardware" folder, what could be the reason of this issue?
@erfansn869
@erfansn869 3 жыл бұрын
Thanks What is R1 on board joystick?
@chiragjeram
@chiragjeram 4 жыл бұрын
thank you sir for nice video, can you guide how can i use yours' beginner guide sketch to make 1 joystick and 20 push buttons on arduino leonardo?
@danstechbox7077
@danstechbox7077 4 жыл бұрын
Hi Chirag Jeram! Thanks for the comment. Hope i can answer your question properly. To use the arduino leonardo, you literally just need to change the board - the only difference between the two in regards to this project are the number of pins and the pin numbering. Nothing in the code would change apart from adding in the extra buttons and removing your unused axis. HOWEVER, although the technical spec says that the board has 20 Digital Pins and 6 Analog pins, a number of these pins are shared due to the nature of the chipset, and as a result you can have a maximum of 20 Digital Pins, 14 Digital Pins and 6 Analog Pins, OR Any variation of the above. For this kind of setup, you would be limited to 18 Digital Pins for buttons, and 2 Analog pins for the X/Y of the joystick. If you reeeally need 20 buttons, you could either go for a button matrix (more complicated option) or swapy the board out for the Arduino Due, which has significantly more Digital Pins, but that may be overkill depending on your project. Below I'll go into the changes for the code, regardless of your board choice (I wont go into button matrixing as that is a video unto itself) In the Joystick Initialisation section, reduce your axis to just including X and Y, everything else for false, and change the number of buttons to 20 (or however many you want). For the Joystick - In the beginner Guide Sketch, you would use the X/Y axis of the Joystick as A0 and A1, set up with the hardware how I wired the joystick up in the video - Just comment out or delete the "#define joy####" lines with whichever axis you dont wish to use, and likewise the Axis Initialization and Axis Reading sections for the axis you are not using. For the Buttons - Duplicate the "#define joyButton####" lines, changing the button number and pin inputs for your buttons to the button number (in this case 1-20) and the pin you are putting it in to in the Arduino board. Likewise, set up the "pinmode" of the extra buttons as demonstrated for button 1-3 in the code, and make sure to do the same for the "LastButton#State" section per button, or none of them will work. You will then need to copy the "Current Button State" IF loop per button in the "Button Reading During Runtime", changing the button Number for every copy. If you want to, rather than copying them individually, you could subnest the IF loop and do a for loop to cycle the test between buttons 1 and 20, but only if you feel confident doing that. Otherwise, everything else should be as it is in the video. Let me know if you have any more questions.
@chiragjeram
@chiragjeram 4 жыл бұрын
@@danstechbox7077 thank you very much for detailed reply....i will make it practically and then let you know how it goes........have a good day !
@battlebros7075
@battlebros7075 3 жыл бұрын
Nice Video!!! It resolved a lot of my problems. Is it possible to connect the arduino with a shift register and use the Joystick Library for having more buttons?
@techie2337
@techie2337 4 жыл бұрын
Greetings. Thank you for the video. I just found the joystick library and I have been trying to figure out how to use it. I created my own circuit board that hold a Leonardo. One of many questions I have is how would you assign analog inputs coming in from shift registers to individual variables to be called later as buttons? I'm waiting to see how you created an array for multiple buttons as well. I'm very much new to this so watching you explain your code has helped. Still so much I don't understand. Thanks for the videos.
@danstechbox7077
@danstechbox7077 4 жыл бұрын
Will be doing one on button arrays (both binary and row-column) soon. I will also be doing input/output multiplexing using muxing boards (might also be called shift registers but that’s the name I know them under). I am currently writing a series called: “How to (Properly) Arduino to cover the basics of wiring and coding inputs and outputs in an appropriate and board-safe manner, so keep tuned! Waiting on some parts but will be recording soon!
@UzairAli001
@UzairAli001 Жыл бұрын
I can't find boards.txt there is no hardware folder. I'm using Arduino IDE 2.0
@manamdigeable
@manamdigeable Жыл бұрын
hi, Thx for the tutorial. can I use this program for using rotary encoders in flight simulators ??
@CapungPlastik
@CapungPlastik 3 жыл бұрын
Great tutorial! Btw, I've read some other examples. they have different values for the "set Axis" like (-127,127), (0,255), (-512, 512), (0,1023).. any info on this and what value should we choose? regards
@Johan-ex5yj
@Johan-ex5yj 3 жыл бұрын
That is probably related to the mechanical limitations of the setup. Example: You have built your own rudder- pedals. The travel in the potentiometer you are using is limited, only giving a voltage output from 1 to 4 volts (not 0 to 5 volts). If you put this into your sketch (without any range or map) and print out the values you are getting, it will be something like 204 to 818. The rudder in your Simulator (expecting 0 to 1023) will not turn its full range. So what you do to fix that, is set the range like this: Joystick.setRudderRange(204,818). Then everything will work fine.
@CapungPlastik
@CapungPlastik 3 жыл бұрын
@@Johan-ex5yj Hi, sorry if discussing this within the comment section. So I build a wireless drone simulator dongle using this library for the input. Its recepting values within 0-1023 for AETR input. While other simulator accepting the input as like in the game controller tab (after calibrated), some other simulator only works on certain values of input. like 0 to 127 or 180 to 360.. eventually I could manage this using Range and mapping, but when I connect the module to Android, it needs 0-1023 input. So using a mapped values will limit the stick movements. So, is there a way to recognize or manage the input for different device or OS (computer and mobile phone/Windows and Android)? (beside adding a button to switch value based on device 😀) Regards
@Johan-ex5yj
@Johan-ex5yj 3 жыл бұрын
@@CapungPlastik Yes, if you have simulators that expect other input ranges than the standard 0- 1023, you will have to use different range settings in your Arduino sketch. If you want to use the same Arduino micro for these different simulators, I would add a DIP switch connected to some digital inputs as a way to select the range to use. If you are developing your own simulator- interface in Windows or Android, you could use the serial port that the Arduino provides to communicate to your Arduino sketch to specify what range you want to use.
@MonicaYap
@MonicaYap 2 жыл бұрын
@@Johan-ex5yj hello sir can you help me? i am planning to use the potentiometer as a roll and pitch for my diy yoke. It doesn't obtain the full range. I tried the original code from this video, it is 0-1023 , 0-255. In the properties of my arduino, the value is flickering/changing even after I calibrated it. What should I do about this? What value should i use then?
@Johan-ex5yj
@Johan-ex5yj 2 жыл бұрын
@@MonicaYap Do not calibrate, use the min/max numbers obtained from Serial.println(Val) command in your sketch, entering them into Joystick.setRyAxisRange(Min?, Max?) afterwards. If this still gives too poor resolution, you need to find pots with smaller electrical angle (90deg or less), as is used in joysticks. Another way to go is to use Hall Effect Sensors. See this video >> kzbin.info/www/bejne/iZjUl5-ZfaeHrcU
@gkps2363
@gkps2363 3 жыл бұрын
Can you make a video of the matrix buttons? I think what you said very well helped me a lot
@joaolancha8824
@joaolancha8824 4 жыл бұрын
Hey dude, Amazing video, helped me so much. Im running into a little bit of an issue, i dont know if maybe you can help me. Im currently making a button box for xplane, and to do a test i just connected a toggle switch to the arduino micro and made a joystick (exactly like you did) but with only one button, uploaded the code and tested on the windows manager for usb game devices, everything was working.However, when i connect the arduino micro and go into Xplane the game freezes, do you have any idea what can be causing this issue? Thanks in advance
@danstechbox7077
@danstechbox7077 4 жыл бұрын
Glad it helped you! It could be a number of things. I know XPlane has a few reserved USB device ID's, so you might need to change the device ID as I outline in the video to something further along, just to ensure that it's not clashing with anything. With Toggle Switches, it could be the continous signal - in a few of my games I know i've seen this issue. I am currently working on a function module to take a toggle switch and get the code/windows to treat it as two discrete button presses, but I'll need a bit of fiddling to make sure it works, and likewise will also require some input on the user end to make sure that the switch position matches up with the simulation position. For now, try removing the toggle switches and using push buttons instead - see if that get's XPlane to play nice. Otherwise, try shifting the USB device ID along a bit in case you've hit a reserved value. Hope that helps.
@Vintage_USA_Tech
@Vintage_USA_Tech 3 жыл бұрын
Man that was a great video.... That really helped me understand how this library works and how easy it is to use, 2 question's have you had the time to get the hat switch video done yet? and 2nd you have a folder called hardware in your Arduino folder where you changed the name of the board in the board text file.... I do not have that folder I'm running IDE version 1.8.13 and it is a fresh install.... how do you get that folder with the board information?
@Vintage_USA_Tech
@Vintage_USA_Tech 3 жыл бұрын
Ok scratch that 2nd question I installed the Arduino IDE from the App store and that comes with its own can of worms when it comes to permission's I have a feeling the board.txt file is in there I just need to figure out how to get access to it. Windows is such a turd... cant wait until I can use Linux as a game box.
@BooktownBoy
@BooktownBoy 3 жыл бұрын
@@Vintage_USA_Tech Just create the hardware folder in Documents>Arduino alongside your libraries and sketches folders, then create a named folder inside that, copy the avr folder from the google drive link (unzipped) into that named folder and edit the boads.txt as required. Profit??? Just learned myself so thought I'd chime in :)
@naveenDEAS
@naveenDEAS 3 жыл бұрын
First of all I would like to thank you for providing such an informative and useful video. Really!! Actually I was planning to make a arcade joystick using a keyboard encoder taken out of a usb keyboard. But using a Arduino Leonardo looks much efficient and better. I have some questions!! I am planning to make a Mame arcade encoder with 4 direction keys + around 14 other keys to play and control the settings of Mame. As you know, in arcade fighting games, we press multiple keys simultaneously ( for example, up+right+ button 1 etc), will it be possible to do so without any delays? In computer keyboards, when we press multiple keys, we have problems such as keyboard ghosting and masking. So Arduino leonardo keyboard encoder will have the same problems?
@xaviercaju
@xaviercaju Жыл бұрын
Hello! Could be possible to use this for a PlayStation controller?
@paulb36utube
@paulb36utube 3 жыл бұрын
This is a nice simple explanation. I’ve had to figure out through trial and error ( and a few tears) wish I saw this way earlier. One question I have been able to do a twin joystick with that library. I’ve gotten a twin gimbal (used in RC drones) that run off 3.3v that I’ve hooked up but just can’t get them working together (and the sensitivity is outrages -thinking I need either hardware or software debugging ) [Frsky M9-Gimbal M9 High Sensitivity Hall Sensor Gimbal For Taranis X9D & X9D Plus RC Parts] Any chance of giving it a crack? The software that is.
@thoufeekbaber8597
@thoufeekbaber8597 2 жыл бұрын
this is gem..but can i do same procedures in uno??
@Sanchez9241
@Sanchez9241 Жыл бұрын
how to add vibrations to this joystick library?
@BooktownBoy
@BooktownBoy 3 жыл бұрын
This is an excellent video, thank you. Just a question about giving the pro micro's a unique name...would I need to rename, change PID (do I make up PID?) upload to board, then change it again to another unique name before uploading the next sketch to the next pro micro? ie, "joystick" PID x for first pro micro and "throttle" PID y for second one... I couldn't quite follow that part of the vid.
@BooktownBoy
@BooktownBoy 3 жыл бұрын
EDIT: Don't worry, I've sussed it after going over the end of the vid a few times. ^ThumbsUp^
@theshawnmccown
@theshawnmccown 2 жыл бұрын
What would I need to add to set a deadzone?
@FERNANDOPENAS
@FERNANDOPENAS 3 жыл бұрын
How do I declare multiple buttons in a single input in this code? I understand the wiring but do not know the code.
@Stratlegend
@Stratlegend Жыл бұрын
Very good tutorial, but 1 question. In the Set up USB game controllers the joystick recognized for calibration and use only hen the arduino ide sodtware runs. If the IDE close the controller stop working. Maybe stupid question, but why this happend? Need also software for communication? Thanks!!!
@toyoboi
@toyoboi 3 жыл бұрын
you should make another video. I'm working on my first project (a 6 DOF joystick using a stewart platform) and I'm struggling with quite a bit.
@yeloyoung9944
@yeloyoung9944 2 жыл бұрын
does it works on arduino uno?
@lironkalfa5479
@lironkalfa5479 3 жыл бұрын
I can use a 3 analog joystick?
@malejvelkej_
@malejvelkej_ Жыл бұрын
Hi, i have maybe an issue, when i'm in the game controler properties and i have for exmaple throttle and z rotaion set in the code and when i turn the potentiometr it moves with both of the values please help
@brianpaavo8192
@brianpaavo8192 3 жыл бұрын
Thank you very much. This was a great video for the first steps, I've successfully created two arduino leonardos each with several buttons and potentiometers. I'm clearly missing something at the end (as I see other commenters have)...I have created an alternate boards.txt file, altered the name, pid, and vid, then uploaded the sketch to one of the leonardos. When I open USB controllers to calibrate I only see one leonardo even though both are plugged in. There's something seeming skipped quickly past on creating a ?second? hardware directory? Went through several times...can you expand on that step please?
@brianpaavo8192
@brianpaavo8192 3 жыл бұрын
Renaming a second Leonardo is much more complex now. On Windows10 the ACTUAL boards.txt file is in the WindowsApps folder which is one of the most heavily protected locations and uneditable without complex permissions changes which are dangerous for other windows apps. The intermediate solutions seems to either use a Linux system OR us an earlier non-admin installation of the IDE. Working on that now.
@Johan-ex5yj
@Johan-ex5yj 3 жыл бұрын
@@brianpaavo8192 My Arduino Pro Micro can be programmed as a Board: “Arduino Leonardo” ; or as a Board: “Arduino Micro”. Both works fine as a Joystick. This gives you 2 different names in Devices. *(and that is just using the standard installation, without adding a boards.txt of your own)* I do not have 2 Arduino Pro Micro boards so can’t test if both will work at the same time. But this is something you can try, and please report back to say if this is a good alternative method.
@tnpotomacrr4792
@tnpotomacrr4792 3 жыл бұрын
It seems I was able to change an Arduino Micro name by finding the boards.txt in the Hardware folder that resides in the Arduino IDE program files. When I added my own boards.txt under the documents/Arduino/Hardware, the boards.txt there was ignored and uploading the sketch would revert back to the boards.txt in the IDE’s program folders.
@lancelot4915
@lancelot4915 4 жыл бұрын
Excelent tutorial, the best i found to get and idea of how to have a HID joystick with an Arduino. My question would be, is it possible to wire 32 buttons and four axis to the Leonardo? How?. The library allows it, but don´t know if it is possible with the board.
@danstechbox7077
@danstechbox7077 4 жыл бұрын
The Four Axis wouldnt be an issue with the Leonardo, however with the buttons you'd hit the pin limit pretty quickly. The way I see it, you have three options: 1) Get a board that has the right number of pins AND is USB HID complient and do a One-to-One pinmapping approach - in this case you'd be limited to the Arduino Due 2) Do a Row-Column approach for the buttons using standard keyboard matrixing - there are several guides on how to do this online. 3) Use a Button library, such as AceButton, which has compatibility for Binary button mapping (using base 2 binary as pin inputs) - you'd only need 6 pins for 32 Buttons, in this case. There are approaches using resistor ladders and analog inputs, however depending on your board and other circuitry, this could just complicate things, especially if there's any noise on the wiring or switches. I personally would consider looking at the AceButton library for this, as it has excellent de-bouncing support for button presses too - however, if you want to keep your wiring and code simple, get an Arduino Due. They're avalible on Ebay for about £10-£15 a board. I will be doing a video at some point soon about Binary Button Mapping as I think it's a very valid approach in comparison to Row-Column matrixing.
@Tom_GTom
@Tom_GTom 3 жыл бұрын
I think this should work for your issue. www.instructables.com/How-to-access-5-buttons-through-1-Arduino-input/
@lancelot4915
@lancelot4915 3 жыл бұрын
@@Tom_GTom Thanks Tom for the link. Reading it now.
@lancelot4915
@lancelot4915 3 жыл бұрын
@@danstechbox7077 Thanks for the answer, after some reading, i finally decided to go with the matrix. The third option is completely new for me, but i will start to research about it now,. At first glance it seems the best solution.
@andrewjamez
@andrewjamez 3 жыл бұрын
hi there thanks for your tutorial, Are you able to name your device? for example I am building flight sim controllers and want the name of the controller to show in the joystick calibration menu and not just "arduino Leonardo"...
@jason6344
@jason6344 4 жыл бұрын
I am very new to this and trying to make a joystick that emulates a controllers left analog stick. I have a joystick module and am soon to get a leonardo board . I am not so sure what to do past this.
@danstechbox7077
@danstechbox7077 4 жыл бұрын
If you watch the video and follow along with the way I've wired up the joystick, and when you're defining the code you only need to have the X and Y axis included (along with a button press if you want that in there too), that should do the job.
@simtcr
@simtcr 3 жыл бұрын
Will this work with a esp8266 nodemcu?
@technicahmett
@technicahmett 4 жыл бұрын
Good job dude. Thank you... Firstly I try it quickly on files in my Arduino IDE, but didnt work. Then I try again your uploaded files and it is work. What are the differences?
@danstechbox7077
@danstechbox7077 4 жыл бұрын
Are you trying the example code in both instances, or is your own code not working, and then my code is? One of the ways I troubleshoot my code is I use the compile/verify feature to check my code for basic mistakes prior to upload - its the little check-mark button next to the upload button. Make sure your board is selected in the tools menu, and then when you verify, it should give you a little diagnostics panel at the bottom. The orange text is the errors, and it should highligh the location in the main body of the code as to where the error is - this should give you a better idea of what's going wrong with your code.
@technicahmett
@technicahmett 4 жыл бұрын
@@danstechbox7077 That is not code. That is your uploaded files (AVR, bootladers, boards)...
@danstechbox7077
@danstechbox7077 4 жыл бұрын
​@@technicahmett Aaaah sorry, got a bit confused there. The boards.txt definition was simply a descripter/payload for the bootloaders - in this case it redirects to the Caterina-Leonardo bootloader within that file. If your stock bootloader isnt working, that sounds like an issue with the Arduino IDE's stock/default bootloaders, so it might be worth removing them in file explorer and re-installing them via the boards manager in Arduino IDE. Otherwise, a fresh install of the IDE should fix that issue, but make sure to make note of your installed libraries as they can sometimes be removed in the uninstall process.
@technicahmett
@technicahmett 4 жыл бұрын
@@danstechbox7077 I copied to under my doc folder from Arduino folder. But dont work. but no problem friend. I downloaded your files and it is ok. Thank you...
@stevling1
@stevling1 Жыл бұрын
I'm a bit new to this how do I update that boards.txt file so it works in newer versions like 2.2.1 thangs for the Guide :D
@dylans4776
@dylans4776 3 жыл бұрын
Would you happen to know how to hookup a 3 position switch (mainly the coding for that) I’d like to use it as a flaps switch
@Johan-ex5yj
@Johan-ex5yj 3 жыл бұрын
Assuming a centre- off- 3 position switch and using A2 input and RzAxis. Connect a 10kΩ resistor from A2 to Vcc Connect a 30kΩ resistor from A2 to Gnd Connect top terminal of switch to Gnd Connect middle terminal of switch to A2 Connect bottom terminal of switch to Vcc In your Sketch: In the setup section use: Joystick.setRzAxisRange(0, 1023); In the loop section use: Joystick.setRzAxis(analogRead(A2) - 512); This should give you (in your flight sim) a control surface that is centralized when the 3 position switch is in up position, half way down when switch is in middle position, and all the way down when switch is in down position. If your control surface is moving in the wrong direction, simply use Joystick.setRzAxisRange(1023, 0); instead.
DIAL UP YOUR COCKPIT with Arduino and Air Manager:Beginners Guide
26:57
How to Use a Joystick with Arduino: Wiring and Basic Controls
13:44
Rachel De Barros
Рет қаралды 21 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
I made a VR cockpit from PVC pipe
16:14
Akaki Kuumeri
Рет қаралды 108 М.
3 engineers race to design a PCB in 2 hours | Design Battle
11:50
Predictable Designs
Рет қаралды 558 М.
Getting started with the Arduino Joystick Library
16:38
Jason Winfield
Рет қаралды 2,6 М.
Beginners guide to game controllers with Arduino
7:57
CNCDan
Рет қаралды 9 М.
DIY Flight Simulator Joystick
9:10
Tom Stanton
Рет қаралды 1,1 МЛН
Flight Sim Basics (Part 1): Connecting a Switch
11:27
The Warthog Project
Рет қаралды 80 М.
MAKE THIS BUTTON BOX | 32 FUNCTION w ENCODERS
7:38
amstudio
Рет қаралды 2,2 МЛН
DIY Arduino Helicopter Collective Joystick Control
22:44
element14 presents
Рет қаралды 135 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН