Тёмный

Using a Game Controller with Arduino and Processing 

MakeUseOf
Подписаться 231 тыс.
Просмотров 116 тыс.
50% 1

Опубликовано:

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 112   
@dopeboi9680
@dopeboi9680 3 года назад
Great tutorial. It took me 3 days to get everything right. One I wasn't paying attention and two I had to do some tweaking. Instead I used this motor shield I just bought and a computer game controller. Very amazing and I'm still a novice at all this but my overall computer skills still above average.
@GaryParkin
@GaryParkin 4 года назад
OMG, Thank you sooo much for this video. I had not used Processing before. It's wonderful.
@sbpcls
@sbpcls 3 года назад
i followed your steps as you went and it all worked well. now next phase i explained below.
@markiesheli
@markiesheli 3 года назад
I was able to use a cheap stk 7007f bluetooth controller with processing. I was able to map al de buttons from the controller over the bluetooth dongle via the GCP configurator. Awesome! Thank you for the great video!
@VortexMotiveVision
@VortexMotiveVision 3 года назад
This is great - Works really well. Is there no way to get this to work with the arduino as a standalone unit (without the computer)?
@asgorreidaa
@asgorreidaa 6 лет назад
Congrats for your excellent presentation. 🖒
@ciprianpasca7738
@ciprianpasca7738 5 месяцев назад
Thank you for this. This helped me a lot for my university project.
@name_it
@name_it 6 лет назад
Absolutly fantastic
@GaryParkin
@GaryParkin 4 года назад
Add in another servo and duplicate the 2 lines, servoWrite & the map's. Oh and also, you should be using a power supply to run the servos. Don't use the USB's power or sometimes it will disconnect with no reason. That happened to me, I thought it was my port going bad. (DroneBot Workshop has schematics on how).
@henryshaener1730
@henryshaener1730 3 года назад
@@GaryParkin i tried this and only one joystick will work and for some reason it controls both servos, and advice?
@GaryParkin
@GaryParkin 3 года назад
@@henryshaener1730 It's been so long since I did this project. I think: Make sure the server id's are different. Maybe you duplicated the pinMode?
@henryshaener1730
@henryshaener1730 3 года назад
@@GaryParkin i was able to get the joysticks working by making a second float value, sorry to bother you again but would you know anyway to use it with one of the controllers buttons?
@GaryParkin
@GaryParkin 3 года назад
@@henryshaener1730 I honestly don't remember. It's been a long time. :) Sorry.
@zimbow095
@zimbow095 3 года назад
I followed exactly how you do but why i go this "NullPointerException" on line thumb = map(cont.getSlider("servoPos").getValue(), -1, 1, 0, 180);. can you help me with this
@pranavdhawan4471
@pranavdhawan4471 Год назад
How can we perform the same thing but with an ESP32 instead of Arduino?
@teltowfamily2223
@teltowfamily2223 Год назад
thanks : ) I am trying to build a robot to be accepted in to a technology school and this will help me control it!
@amirafshari1613
@amirafshari1613 5 лет назад
fantastic work. Educative and funny. I almost died at 13:50
@asifmuktadir9299
@asifmuktadir9299 5 лет назад
If I intend to connect the Arduino to the laptop using a Bluetooth module HC-05, what changes do I have to make in the Processing code?
@fahadahmed480
@fahadahmed480 5 лет назад
yeah i also wanna know this If you've figured out how to do it please help me too
@nithishlogaraj3094
@nithishlogaraj3094 4 года назад
Is possible to control the servo directly with the gamepad by connecting the reciever with arduino
@fouzanjaved5441
@fouzanjaved5441 2 года назад
Sir, I like the video tutorial on how to control the servo using Arduino with an Xbox joystick controller. Sir, can you make a video on how to make an Xbox-controlled 4-dof robotic arm car using a wireless Xbox 360 controller and give me the circuit diagram and the code for the Xbox-controlled 6-dof robotic arm car using the wireless Xbox 360 controller?
@rafeneathery9155
@rafeneathery9155 4 года назад
Is there a way to record the input from the controller, save it, and use it to repeat the same motions? For example, I control the servo with the controller, and then later I can make it replicate those same movements.
@sbpcls
@sbpcls 3 года назад
now how to run this code natively using usbshield on top essentially bypassing the computer and controlling servos with assigned joystick attached?
@Nimer001
@Nimer001 Год назад
Really nice tutorial, simple and fast.
@suryanshsingh8550
@suryanshsingh8550 Год назад
were you able to find the game conrol plus library I can;t find it in IDE
@tylertrent8226
@tylertrent8226 5 лет назад
Awesome video! Helped me a lot!
@kennethkindrich3114
@kennethkindrich3114 4 года назад
@MakeUseOf i want to control multiple servos with this with different areas of movement, however, when i try to add some more servos, the all move with the x axis and not the x and y axis......help?
@tylorfranca9096
@tylorfranca9096 5 лет назад
Anyone know what code to write in public void section if buttons out named with int and not void
@lemonjuice3071
@lemonjuice3071 4 года назад
for some reason, when i run the final program, it does not recognize my controller. I ran the control config, and managed to bind a variable to my left joytick without worries, saved it and passed the file to the same respective place showed in the video. Yet, it did not work when i ran the program. Could anyone help?
@hailharraz9824
@hailharraz9824 5 лет назад
Hello, I would like to ask about the coding on how to use both joysticks on an Xbox controller that can move two motors, as in the left stick controlling the one motor and the right controlling the other. And if I use the joystick, how should I make it so that if it goes to -1 on the y-axis, the motor will stay at its last position and won't revert back to its original position when the joystick goes to 0 on the y-axis? And if I hold it on -1, would it continue to rotate the motor or will it just stop? Is there some other way coding it? I hope you can respond soon, sorry for asking so much!
@Harrzack
@Harrzack 5 лет назад
Dude! Testing a variable as == null will always return false. Use the function “isnull()”.
@brendanhansknecht4650
@brendanhansknecht4650 5 лет назад
you should double check before you comment. In processing, == null does work. In fact, isNull() does not work because 'The function isNull(ControlDevice)" does not exist'.
@joxl7
@joxl7 4 года назад
Great video, really helpful. How would you go about looping the servos so when the user presses and holds forward on the joystick, the servos continuously move back and forth?
@echo_smart4459
@echo_smart4459 5 лет назад
Nice video! How can i use a gamepad that connects remotely to the arduino robot without having to plug it into the pc? Maybe with a usb female module? Will it work?
@MakeUseOf
@MakeUseOf 5 лет назад
No, you need something capable of USB Host mode, with drivers to understand the device.
@saqifyeasir1100
@saqifyeasir1100 5 лет назад
Can u help me making a computer keyboard turn into midi controller. I want to do this because, i ve a keyboard in which a few keys dont work. So i would love to convert that into midi device. So that i can make use of that as a controler while using my main keyboard. I hove you understood me.
@ciprianpasca7738
@ciprianpasca7738 4 месяца назад
Question: Ca i do this if i use a wireless controller and a bluetooth module on the board?
@andrewcastillo3171
@andrewcastillo3171 2 месяца назад
im confused how is it controlling the servo without a receiver?
@mikehoss3302
@mikehoss3302 Год назад
So for connecting the controller to the computer are you just using a usb to the computer?
@GaryParkin
@GaryParkin 4 года назад
Has anyone worked with sending from Processing to the Arduino while using a PCA9685 multi servo board? It seems it needs the Adafruit_PWMServoDriver but Processing can't load it. It talks I2C.
@bix7959
@bix7959 Год назад
I have done everything the same as you showed it in the video. I'm able to controll the servo until the xbox one controller just randomly disconnects from my PC. Do you know how to fix this issue?
@azatylmza36
@azatylmza36 4 года назад
hello sir , ı wanna do it this with brushless motor , can you please help me about that ?
@briancalhoun4124
@briancalhoun4124 Год назад
Hello, thanks for the tutorial. Do you have any input on connecting the servo to a button? Any coding video for that? I have been trying to switch between cont.getSlider with the triggers/sticks and cont.getButton but am not sure how to set that in the code. The button is controlling a servo for a claw arm of a robot I am working on. Thanks
@ARandomHumanBein
@ARandomHumanBein Год назад
What if i need to use a ps4 controller with and Arduino wich is not attached to a PC.
@MakeUseOf
@MakeUseOf Год назад
You can't. The Arduino is not a bluetooth or USB host, and doesn't have the drivers to process the signal from the controller. Needs a PC inbetween, or Raspberry Pi.
@Nuke_Gaming123
@Nuke_Gaming123 Год назад
hi i have a problem where after a few seconds of running the code something disconnects, it works fine until either the Arduino or the controller disconnects (not sure which) and the servo stops rotating, how can i fix this please?
@evertspies3345
@evertspies3345 4 года назад
Not sure if Im missing something...is the controller a bluetooth device or how is the controller connected to the arduino?
@MakeUseOf
@MakeUseOf 4 года назад
The controller is connected to a PC, and the PC relays commands to the Arduino using Processing. There's no way to connect it directly since the Arduino cannot act as a USB Host device.
@evertspies3345
@evertspies3345 4 года назад
@@MakeUseOf As I do not own a xbox but I have found a Xbox controller I did not know that the output was USB. My unit has a 4 pin connector on it and I will now Google it. Thanks for the reply.
@GaryParkin
@GaryParkin 4 года назад
@@evertspies3345 If you are in the States, you can get an XBox controller PC USB device for about $30 at Best Buy. Hope this helps.
@evertspies3345
@evertspies3345 4 года назад
@@GaryParkin Thanks for the tip, unfortunately I am in South Africa.
@mdaravee
@mdaravee 3 года назад
@@MakeUseOf i have this board it has built in bluetooth the boar is Romeo BLE mini v2.0
@aruls7233
@aruls7233 5 лет назад
Bro based on this ,how use motors for drone with yaw ,pitch ,roll program 🙃
@josemarcostorresjanko9917
@josemarcostorresjanko9917 4 года назад
Wow... amazing
@dominikapierzchaa8596
@dominikapierzchaa8596 4 года назад
How can I connect my controller - xbox360 with my computer. I am talking abot 4:06 on your video. I can't see "Controller (XBOX 360 For Windows) [GamePad] on my computer. Do I need USB cabel thanks to which I will be able to connect my xbox controller with computer. Please help me :(
@Nuke_Gaming123
@Nuke_Gaming123 Год назад
Does this work if the device is connected using Bluetooth?
@kurumll2361
@kurumll2361 Год назад
hello, do you have a video on how to control a nema 17 stepper motor with a control and processing
@M3e36-99
@M3e36-99 Год назад
Does this work with the Xbox One controller and the newer controllers?
@orilevi026
@orilevi026 5 лет назад
thank you!
@Brad_Jacob
@Brad_Jacob 5 лет назад
Is there not an easier way to achieve this by using an Arduino Pro Micro which has on-board USB connectivity?
@MakeUseOf
@MakeUseOf 5 лет назад
Not that I'm aware of: the Pro Micro can emulate an HID like mouse or keyboard itself, but it can't accept the input from one, as that would require device drivers.
@Brad_Jacob
@Brad_Jacob 5 лет назад
MakeUseOf I see. Thanks for clarifying!
@owl2464
@owl2464 4 года назад
Is there a way to connect a Nintendo dsi with the processing sketch and arduino?
@hamzagod-ii1528
@hamzagod-ii1528 4 года назад
That would be cool.
@aayushyadav7760
@aayushyadav7760 4 года назад
Is it also possible to get this done with ESP8266??? If yes, then can anyone help me out with it.
@bobodiesenhaus5157
@bobodiesenhaus5157 5 лет назад
With the final code , the "cont = control.getMatchedDevice("xbs");" part is causing processing to have trouble because it is trying to get a file called "C:\Users\Owen\AppData\Local\Temp\Temp1_servoController.zip\servoController\data\xbs", but my xbs file is called "C:\Users\Owen\Documents\Processing\servoController\data\xbs".I can't seem to move the xbs file so that it would be called what the program is trying to find(C:\Users\Owen\AppData\Local\Temp\Temp1_servoController.zip\servoController\data\xbs). How do I make the program get the correct file?
@rodgersifederer7692
@rodgersifederer7692 5 лет назад
yes
@bobodiesenhaus5157
@bobodiesenhaus5157 5 лет назад
Rodger SI Federer what?
@Zortyox
@Zortyox 27 дней назад
What is the range?
@AmazingBuildsTutorials
@AmazingBuildsTutorials 11 месяцев назад
How do I make it for 2 or three servos
@yeetingboy7642
@yeetingboy7642 Год назад
Mine will just randomly stop for no reason there is not error in the code
@tyagiaryan82
@tyagiaryan82 3 года назад
Thanks a lot for this tutorial! Works perfectly with my ps4 controller. I am having a hard time trying to display text on the lcd 1602 device while having my controller connected to the arduino, the liquid crystal library doesn't work on processing. Any help would be appreciated.
@roniakeren6843
@roniakeren6843 9 месяцев назад
Hi, how did you connect the ps4 controller to arduino?
@first-persondiy6909
@first-persondiy6909 5 лет назад
Great tutorial! So how do you get it to read a button press/release? I think I figured out the easy part. I set a variable called trigger to getUserInput --> trigger = cont.getButton("servoTrigger").getValue(); I get that to move the servo, but I want to use it in an if statement. The thing I can't figure out is how to open the if statement? if (trigger == 1){ Do all this stuff } It's obviously not that because it doesn't work. haha
@GaryParkin
@GaryParkin 4 года назад
@First-Person DIY If you look in the configurator, it seems the buttons are not bool's, they are floats. On button down it returns an 8.0. Bery weird but you could write a function that returns a true false. :) Hope this helps.
@first-persondiy6909
@first-persondiy6909 4 года назад
@@GaryParkin That helps. Thanks!
@ameliak3427
@ameliak3427 5 лет назад
How would you get the servo to desired position then freeze until further instruction on where to go?
@MakeUseOf
@MakeUseOf 5 лет назад
Isn't that what it does anyway? It only moves on user input...
@ameliak3427
@ameliak3427 5 лет назад
Once you release the joystick the servo returns to its original position and as I'm controlling the position of a robot this is not ideal. So how would you turn the joystick to a specific position then let go without servo going back to 0,0.
@MakeUseOf
@MakeUseOf 5 лет назад
@@ameliak3427 I see... the problem there is that the system would have no way of knowing you were finished with the movement. As far as it knows, it's getting a new value from the joystick every few milliseconds (it's analogue). So, in order to freeze the value, you would need to define some criteria like "if the value in Z axis is less than what it was before, ignore the new value" (so only the larger value on the outside edge of the joystick would ever count) - or use a button press as a way to notify the system you wouldn't it to stay there at the value. Coding that is a bit outside the scope of what we can do here, but maybe it's given you some ideas?
@GaryParkin
@GaryParkin 4 года назад
@@MakeUseOf Doing that will work but then how would you get the motor to return to 0. You'd have to set up a button as you suggested. If that's the case then maybe the use of sliders (outside of this tut.) would be better for @Amelia Kitt
@GaryParkin
@GaryParkin 4 года назад
Edit: last night I thought about this and I have a solution for you but it requires 2 more variables; One to take in the raw value from the controller, and a second to round that number and add it to a constant value that is then Mapped then sent to the servo. This should work like a video game where the harder you press the stick, the faster the crane or tank will go. Stop pressing and the servo stays put. float ctrlIn; float constNum; public void getUserInput() { ctrlIn = float(nf(cont.getSlider("LSX").getValue(), 0, 3)); // To adjust for my controller not going to 0 for some readon if (ctrlIn == 0.004) { ctrlIn = 0; } // Every time draw gets called in the loop, this is incremented and sets the servo constNum = constNum + ctrlIn; // Constrain the number to keep it from going into never-never land // The closer you map these, the more sensitive the joystick will be. if (constNum >= 100) { constNum = 100; } if (constNum
@manwithapan9481
@manwithapan9481 5 лет назад
I want to make a motion simulator, would this be a good place to start ? I'd be wanting to use a HOTAS like x52 and not a controller though.
@MakeUseOf
@MakeUseOf 5 лет назад
www.xsimulator.net/
@manwithapan9481
@manwithapan9481 5 лет назад
@@MakeUseOf Hey thanks, I've been browsing that site, seems a little convoluted though, browsing their forum seems to be a mish mash of information from different users, no doubt it's all there but they really should have just made a schematics tab with a few different types mapped out rather than have to browse though thousands of topics, photo's and guides, ah well guess that's my summer tied up :) Cheers for the reply and I'll be following this tutorial anyway just to get to grips with the thing ;)
@TabletopDungeon
@TabletopDungeon 5 лет назад
@@manwithapan9481 Yeh, it's something I'd love to build but there doesn't appear to be a single, easy to follow guide around, and most of them require welding, which is well above my skill level . Let me know if you find a good guide!
@manwithapan9481
@manwithapan9481 5 лет назад
@@TabletopDungeon Welding is easy m8, just use a mig welder that's gasless and not a big gas welding thing you can blow yerself up withyou can buy one for 80 quid that will probably do. You get welding wire that has something called flux in the middle and it uses that instead of gas... basically you use a metal grinder and get anything down to bare metal , then clamp the two pieces together as you want and just go at it, maybe 10 attempts on some waste metal and you'll have it nice..source used to do mot welding ;)ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-FEJDqJrZyOQ.html or you could always drill and bolt :)
@manwithapan9481
@manwithapan9481 5 лет назад
@@TabletopDungeon This kind of looks like a place to start I've been looking for a few days i favourited this one www.xsimulator.net/community/faq/jrk-setup-guide-eaorobbie.14/ it shows how the motors connect to the control board and to the pc actuall it's kinda falling into place seeing this jpeg :) no arduino in sight tho
@Builtit1
@Builtit1 3 года назад
how do you add more servos on different inputs?
@tanmaysinghal8370
@tanmaysinghal8370 3 года назад
IS it possible that i use it as a separate device, I mean w/o using Computer, like by connecting Arduino with a battery and then using it.
@MakeUseOf
@MakeUseOf 3 года назад
Not with this project, and not with Arduino - the controller needs drivers, which is where the PC comes in. If you used a Raspberry Pi instead, then you basically have a full mini PC there with suitable controller drivers, but you'd probably have to program in Python.
@tanmaysinghal8370
@tanmaysinghal8370 3 года назад
@@MakeUseOf ohh okay, got the point
@directedboozt
@directedboozt 2 года назад
How do i make it possible to use this without having to have it connected to my PC?
@MakeUseOf
@MakeUseOf 2 года назад
Basically you can't, because you need a device capable of being a USB host, and processing the signals from the gamepad. You could use a Raspberry Pi, but that's just a small PC, so it doesn't really answer your question.
@directedboozt
@directedboozt 2 года назад
@@MakeUseOf Wouldn't maybe a bluetooth receiver work?
@arbajsayyad2718
@arbajsayyad2718 4 года назад
Can i use Arduino uno r3 board for this ...?
@MakeUseOf
@MakeUseOf 4 года назад
Yes.
@Steven-lm5kc
@Steven-lm5kc 5 лет назад
Can you share the code, please?
@MakeUseOf
@MakeUseOf 5 лет назад
Link in the description.
@Steven-lm5kc
@Steven-lm5kc 5 лет назад
MakeUseOf yeah, but there is no code, or at least I can't find it.
@MakeUseOf
@MakeUseOf 5 лет назад
Here you go! static.makeuseof.com/wp-content/uploads/2018/02/servoController.zip
@christophertadeo6120
@christophertadeo6120 Год назад
Yeah. this is good. 😳what I really want is use my adruino in making a drone without the tedious task of creating my own transceiver...how will I know where my drone is going though.. Mmm🤔. Time to go looking for fpv vids... 😳
@dejavusailing5202
@dejavusailing5202 5 лет назад
Just wondering if anyone knows how to adapt this to work over bluetooth
@GirlPlus
@GirlPlus 5 лет назад
you would need the bt module and a bit of extra code. If I'm not mistaken.
@GaryParkin
@GaryParkin 4 года назад
I have a remote BT controller that I'll test...
@droneicecreammaker
@droneicecreammaker 7 месяцев назад
Arduino
@atasch9241
@atasch9241 5 лет назад
Turkish subtitle pls
@MakeUseOf
@MakeUseOf 5 лет назад
I'll be honest: that's very unlikely to happen.
@atasch9241
@atasch9241 5 лет назад
@@MakeUseOf ok
Далее
Arduino 101- Crash Course w/ Mark Rober
22:12
Просмотров 569 тыс.
DIY Arduino based RC Transmitter
15:21
Просмотров 1,1 млн
Arduino Game Controller that runs GTA 5
7:37
Просмотров 52 тыс.
The coolest robot I've ever built!
19:40
Просмотров 4,6 млн
Using Servo Motors with Arduino
43:06
Просмотров 1,4 млн
Using IR Remote Controls with the Arduino
35:28
Просмотров 933 тыс.