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.
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!
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).
@@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?
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
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?
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.
@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?
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?
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!
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'.
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?
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?
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.
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.
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?
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
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.
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?
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.
@@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.
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 :(
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.
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?
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.
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
@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.
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.
@@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?
@@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
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
@@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 ;)
@@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!
@@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 :)
@@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
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.
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.
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... 😳