I am using a 360 degree hall effects sensor and trying to get zero to full throttle in only 180 degree turn of a handle. How can I calibrate this? It is for a home built helicopter collective and the hand throttle can only rotate 180 degrees. thanks
Hi there. How can I activate the 32 buttons as in your sketch just shows the connection to pin 2 and 3. As far I know, to have the 32buttons it has to be done with a matrix connecting the digital pin to each other in like 6 rows with 6 columns to make 36buttons. Please help. Regards
I haven't controlled many games. I'm not really a gamer. I don't remember which game I used it with, but it worked when I did try it. Make sure you have the right control settings selected in your game. Some games will need you to select or even calibrate your controller before using it.
How should i use your code ? When i copy/paste it on a blank sketch, it gives me some line errors, and when i add "//" to them, it fixes and uploads, but my computer doesnt recognise it as a joystick.
I am a total newbie to this, i have download and installed the sketch. windows recognizes it as a joystick. Everything perfect so far. My problem is the wiring of the buttons, joysticks and pots, can anyone help? thanks
I get this error: AV8B_Panel:85: error: 'Joystick' was not declared in this scope Joystick.setButton(0,!BATTval); ^ exit status 1 'Joystick' was not declared in this scope Same with your example code
Hi! I am using this lib for my Yoke system, works weel, I only have 2 issue so far, maybe someone could help: 1) how to recognize it as a driving wheel, so instead of X/ Y axis rotation the wndows setting page should show wheel rotation? 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. 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.... How to overcome those small issues? Thanks for the lib and tutorial!
Hi Kevin, I managed to make a joystick move the x and y axis which was checked by going into the windows game controller settings (like you demonstrated). I tried using it with a few games and it wasn't successful. Which games have you managed to control?
hello, I am sorry if I'm asking stopped question I am new to Arduino I have no idea how to write code just try to make joystick to please fsx. I have this error when uploading to Arduino Leonardo, can you or anyone else help to fix this issue, Arduino: 1.8.2 (Windows 10), Board: "Arduino Leonardo" C:\Users\C855-1J2\Documents\Arduino\joy1\joy1.ino: In function 'void setup()': joy1:182: error: 'Joystick' was not declared in this scope Joystick.begin(); // this starts up, initializes, the joystick library ^ C:\Users\C855-1J2\Documents\Arduino\joy1\joy1.ino: In function 'void loop()': joy1:197: error: 'Joystick' was not declared in this scope Joystick.setButton(0,!button_value); // this line writes a logic "NOT" "!" (which means opposite value of what the button_value is) to the Joystick library for button 0. This writes a 1 to the Library if the button_value ^ exit status 1 'Joystick' was not declared in this scope Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master: C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903: C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903 Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master: C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master: C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903: C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903 Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master: C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
Hi Kevin, got a question for you, I used your code and it works great! Setup all my buttons and some potentiometers, but I'm unable to get my loadcell to work (I'm using an hx711 amplifier). I tested it on a normal sketch with an hx711 library and it works great, but cannot get response through the joystick library :( any help is appreciated!
The library has many different wiring setups. there is also a new library (2.0). please refer to the original creators github. www.instructables.com/Create-a-Joystick-Using-the-Arduino-Joystick-Libra/ link to new library instructable. One of the last steps in this instruction has a link to the github page for more documentation. This may also help you a bit: ua-cam.com/video/hoCOq9Ngp44/v-deo.html
+eelcobakker1 I am working on updating my code to work with the current version of the Arduino IDE 1.6.7. I will be posting links to my code in my video description when I am done with the updates. Check back soon.
+eelcobakker1 I've rewritten my code and it works. I put a link in the description of this video to where you can find my code. My Code can be found in the last link in this videos description. There are instructions on how to get this code up and running at the top of the code. Enjoy. Let me know if I can help.
+Kevin Brigadier ok, thank you very much for giving your code. when i saw the code(wich works), i was understanding how it works. With your explanation after every command, things did become even more clear, thank you for that! After uploading the code with some analog stuff ''activated'' I looked at the game controller settings wich gave some strange movements (in the x and y axis). After an hour or 2, i found out that you have to calibrate (found in the ''settings'' tab) the arduino's analog inputs. This took me like one minute.... :-P It works fine, but now I am figuring out why the 2 buttons are activated while no button is pushed.... If I push down the button on I/O pin 2, button number 1 is freaking out and number 2 is unchanged. If I push down the button on I/O pin 3, button number 1 And 2 are deactivated. How do I change this to: push down the button on I/O pin 0, button number 1 is activated. (and so on, untill I/O pin 13) you don't need to give me the whole code on my question. If I have an example of one button, I'll be fine.
Nice movie! Do you think the leonardo with this setup can be uses as a game controller that has gyros, accelerometers, sliders, rotary encoders but still control servos?
It will depend on the potentiometer used. It might be better to go with a low value (1 kilo-ohms instead of 10) to stop the input from being indecisive of what value to hold, should it bounce around slightly between 2 values due to voltage differences. The Arduino might not be the best choice for this should the resolution be higher than the 8-bit output that is supported in most Arduino's for resolution, because this makes for only 127 steps in resolution out of the middle or null zone towards you, and -127 away from you out of null or middle zone. This might be to small for accurate operation, and you might be better off with different boards that have a higher output resolution (instead of 8 bit, 10 bit, which will give you 512 steps of resolution in both directions (some joysticks in broadcast-applications have 1024 or even 2048 steps in both directions, and somtimes this applies for all directions (left-right, up-down), to give you an idea of how low the resolution might be.
@@Dutch3DMaster thanks for your input, since then I modified the library device descriptor to have 11bit resolution so I have 1024 positions. Using a 1k instead of 10k resistor is a very good point! I currently face an issue where the analog input seems like it's not linear even if linear pots are used and the axis is calibrated in Windows.
@@lukaszM46 Not sure what board you are using now, but the analog inputs on an Arduino (well most of the boards anyway) are 10 bit input only, so you might be crossing over into bit-space reserved for a different axis and while the Arduino is doing the calculation, you might end up in lower values which will slow the behavior of the axis down. You might want to try and remap the input values should you happen to have found a way to use 11 bit input for the analog inputs by using map(input1, input2, newvalue1, newvalue2) for the input at hand. I honestly did not expect a reply this fast on such a dated comment actually. Did you manage to make your own flight stick? I myself am building a dashboard for a relatively popular driving simulator. :).
I made a mistake in the last reply. I'm using 10 bit adc on the Leonardo so I have 1024 positions as I have modified the joystick library. By default it has 8 bit resolution thats that's giving 256 positions so all I did was make it use the full potential of the board. But I still have small problems. In general it works but Im also trying to incorporate rotary encoders as part of a large key matrix and responsiveness is not great. Something like an esp32 has much higher clock speeds and would be much. Better I think
I followed a tutorial that is available online. This is not my tutorial. This is where I found my code www.instructables.com/id/Arduino-LeonardoMicro-as-Game-ControllerJoystick/
+Hubert Enzinger I've rewritten my code and it works. I put a link in the description of this video to where you can find my code. My Code can be found in the last link in this videos description. There are instructions on how to get this code up and running at the top of the code. Enjoy. Let me know if I can help.
I am using a 360 degree hall effects sensor and trying to get zero to full throttle in only 180 degree turn of a handle. How can I calibrate this? It is for a home built helicopter collective and the hand throttle can only rotate 180 degrees. thanks
Hi there. How can I activate the 32 buttons as in your sketch just shows the connection to pin 2 and 3. As far I know, to have the 32buttons it has to be done with a matrix connecting the digital pin to each other in like 6 rows with 6 columns to make 36buttons. Please help. Regards
I haven't controlled many games. I'm not really a gamer. I don't remember which game I used it with, but it worked when I did try it. Make sure you have the right control settings selected in your game. Some games will need you to select or even calibrate your controller before using it.
How should i use your code ? When i copy/paste it on a blank sketch, it gives me some line errors, and when i add "//" to them, it fixes and uploads, but my computer doesnt recognise it as a joystick.
I am a total newbie to this, i have download and installed the sketch. windows recognizes it as a joystick. Everything perfect so far. My problem is the wiring of the buttons, joysticks and pots, can anyone help? thanks
Is there anyway to reset the axis ? Mine going left for no reason
Hi bro, i know this video is ki da old, but, i just wanna say, thanks for the code
hello. when I try to compile with Arduino getting an error
Joystick was not declared in this scope
you need to set usb type to keyboard/mouse/joystick
What ? How ?
you go to Tools and then USB type and then select Keyboard/Mouse/Joystick
I can't find anyting under Tools called "usb type"..
Add this and enjoy - Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_MULTI_AXIS, 32, 0,
true, true, false, false, false, false,
true, true, false, false, false);
I get this error:
AV8B_Panel:85: error: 'Joystick' was not declared in this scope
Joystick.setButton(0,!BATTval);
^
exit status 1
'Joystick' was not declared in this scope
Same with your example code
ok, i found out i had to put Joystick_ Joystick; at the top of the script.
How would you wire the 32 buttons and four axis?
Hi!
I am using this lib for my Yoke system, works weel, I only have 2 issue so far, maybe someone could help:
1) how to recognize it as a driving wheel, so instead of X/ Y axis rotation the wndows setting page should show wheel rotation?
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.
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....
How to overcome those small issues?
Thanks for the lib and tutorial!
How do you conect the joystick. I am lost.
Hello i was wondering if Possible can make the same one with 2 analog sticks is that possible? And are you using pull up resistors on the buttons?
Compilation error: Joystick.h: No such file or directory
Hi Kevin, I managed to make a joystick move the x and y axis which was checked by going into the windows game controller settings (like you demonstrated). I tried using it with a few games and it wasn't successful. Which games have you managed to control?
hi , thx for the codes. can I use this program for using rotary encoders for flight sim ?
What's the pot values that i have to use ? Or does it matter ?
this is great
thanks
Arduino IDE 1.6.12 - Doesn't compile for leonardo.
hello,
I am sorry if I'm asking stopped question I am new to Arduino I have no idea how to write code just try to make joystick to please fsx. I have this error when uploading to Arduino Leonardo, can you or anyone else help to fix this issue,
Arduino: 1.8.2 (Windows 10), Board: "Arduino Leonardo"
C:\Users\C855-1J2\Documents\Arduino\joy1\joy1.ino: In function 'void setup()':
joy1:182: error: 'Joystick' was not declared in this scope
Joystick.begin(); // this starts up, initializes, the joystick library
^
C:\Users\C855-1J2\Documents\Arduino\joy1\joy1.ino: In function 'void loop()':
joy1:197: error: 'Joystick' was not declared in this scope
Joystick.setButton(0,!button_value); // this line writes a logic "NOT" "!" (which means opposite value of what the button_value is) to the Joystick library for button 0. This writes a 1 to the Library if the button_value
^
exit status 1
'Joystick' was not declared in this scope
Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master: C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master
Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903: C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903
Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master: C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master
Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master: C:\Users\C855-1J2\Documents\Arduino\libraries\Adafruit_HX8357_Library-master
Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903: C:\Users\C855-1J2\Documents\Arduino\libraries\Arduino-master119903
Invalid library found in C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master: C:\Users\C855-1J2\Documents\Arduino\libraries\ArduinoJoystickLibrary-master
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hi Kevin, got a question for you, I used your code and it works great! Setup all my buttons and some potentiometers, but I'm unable to get my loadcell to work (I'm using an hx711 amplifier). I tested it on a normal sketch with an hx711 library and it works great, but cannot get response through the joystick library :( any help is appreciated!
Any chance you have updated the code for the latest Joystick library?
I haven't. Anyone else have something in the works?
I'd love to do this, but have limited time these days.
very nice project but how to disable unojoy
any wiring diagram ? ...please
The library has many different wiring setups. there is also a new library (2.0). please refer to the original creators github.
www.instructables.com/Create-a-Joystick-Using-the-Arduino-Joystick-Libra/ link to new library instructable. One of the last steps in this instruction has a link to the github page for more documentation.
This may also help you a bit: ua-cam.com/video/hoCOq9Ngp44/v-deo.html
I Followed the tutorial on instructables, but i don´t get the code working for weeks.
Would you please for the love of god give me your code??????
+eelcobakker1 I am working on updating my code to work with the current version of the Arduino IDE 1.6.7. I will be posting links to my code in my video description when I am done with the updates. Check back soon.
Ok, thank you veeeery much!
+eelcobakker1 I've rewritten my code and it works. I put a link in the description of this video to where you can find my code. My Code can be found in the last link in this videos description.
There are instructions on how to get this code up and running at the top of the code. Enjoy. Let me know if I can help.
+Kevin Brigadier
ok, thank you very much for giving your code. when i saw the code(wich works), i was understanding how it works. With your explanation after every command, things did become even more clear, thank you for that!
After uploading the code with some analog stuff ''activated'' I looked at the game controller settings wich gave some strange movements (in the x and y axis). After an hour or 2, i found out that you have to calibrate (found in the ''settings'' tab) the arduino's analog inputs. This took me like one minute.... :-P
It works fine, but now I am figuring out why the 2 buttons are activated while no button is pushed....
If I push down the button on I/O pin 2, button number 1 is freaking out and number 2 is unchanged.
If I push down the button on I/O pin 3, button number 1 And 2 are deactivated.
How do I change this to:
push down the button on I/O pin 0, button number 1 is activated.
(and so on, untill I/O pin 13)
you don't need to give me the whole code on my question.
If I have an example of one button, I'll be fine.
why my buttons don't work
Nice movie! Do you think the leonardo with this setup can be uses as a game controller that has gyros, accelerometers, sliders, rotary encoders but still control servos?
It wouldn't be hard to do, the joystick and accelerometers (... etc) give the same type of feedback. You would likely have to change the code some.
How?
is the analog accurate? I would like to make my own flight stick this way but it needs to be very accurate and sensitive. please let me know
thanks !
It will depend on the potentiometer used. It might be better to go with a low value (1 kilo-ohms instead of 10) to stop the input from being indecisive of what value to hold, should it bounce around slightly between 2 values due to voltage differences.
The Arduino might not be the best choice for this should the resolution be higher than the 8-bit output that is supported in most Arduino's for resolution, because this makes for only 127 steps in resolution out of the middle or null zone towards you, and -127 away from you out of null or middle zone. This might be to small for accurate operation, and you might be better off with different boards that have a higher output resolution (instead of 8 bit, 10 bit, which will give you 512 steps of resolution in both directions (some joysticks in broadcast-applications have 1024 or even 2048 steps in both directions, and somtimes this applies for all directions (left-right, up-down), to give you an idea of how low the resolution might be.
@@Dutch3DMaster thanks for your input, since then I modified the library device descriptor to have 11bit resolution so I have 1024 positions. Using a 1k instead of 10k resistor is a very good point!
I currently face an issue where the analog input seems like it's not linear even if linear pots are used and the axis is calibrated in Windows.
@@lukaszM46 Not sure what board you are using now, but the analog inputs on an Arduino (well most of the boards anyway) are 10 bit input only, so you might be crossing over into bit-space reserved for a different axis and while the Arduino is doing the calculation, you might end up in lower values which will slow the behavior of the axis down.
You might want to try and remap the input values should you happen to have found a way to use 11 bit input for the analog inputs by using map(input1, input2, newvalue1, newvalue2) for the input at hand.
I honestly did not expect a reply this fast on such a dated comment actually.
Did you manage to make your own flight stick? I myself am building a dashboard for a relatively popular driving simulator. :).
I made a mistake in the last reply. I'm using 10 bit adc on the Leonardo so I have 1024 positions as I have modified the joystick library. By default it has 8 bit resolution thats that's giving 256 positions so all I did was make it use the full potential of the board. But I still have small problems. In general it works but Im also trying to incorporate rotary encoders as part of a large key matrix and responsiveness is not great. Something like an esp32 has much higher clock speeds and would be much. Better I think
Is there a wiring diagram?
I was looking for this as well. I have my button 1+2 constantly on.
I followed a tutorial that is available online. This is not my tutorial. This is where I found my code
www.instructables.com/id/Arduino-LeonardoMicro-as-Game-ControllerJoystick/
How the F*** you made 32 buttons with a 14 button pin board????
very nice! where you got the code from?
+Hubert Enzinger I've rewritten my code and it works. I put a link in the description of this video to where you can find my code. My Code can be found in the last link in this videos description.
There are instructions on how to get this code up and running at the top of the code. Enjoy. Let me know if I can help.