New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XBox 360 Stops Responding for Short Periods #166
Comments
Try to remove the 100 ms delay. You have to call the Usb.Task() function approximately every 1 ms. If you still need the 100 ms delay you can use millis/micros instead: https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay. |
Changing to 1ms delay works just fine. If you have time I'd be interested in why the 1ms is important but my problem is fixed so I will not be offended if I don't hear from you. Thanks for your time/help. Ben |
The thing is that you can't read from the Xbox controller to quickly, that is why there is a delay :) |
But it can't be too long either as you have to read from it continuously. |
... and that's why the toggle was wrong? Sounds to me like a broken USB Well, at least in the 3.0 lib, you can just do this sort of thing in the On Mon, Jul 13, 2015 at 12:31 PM, Kristian Sloth Lauszus <
Visit my github for awesome Arduino code @ https://github.com/xxxajk |
@xxxajk I'm not sure what you mean by "the toggle was wrong"? |
@xxxajk the toggle was not wrong. It was simply reading from the input endpoint top fast, but yes 3.0 should be able to take care of it automatically. |
Intro
I'm using an XBox 360 (Microsoft brand wired USB) with an Arduino Mega 2560 and Arduino USB Host Shield. The XBox input will be translated by the Arduino into PWM control of some hydraulic valves. Full code is listed below.
I currently have LEDs attached to the outputs as loads to easily show what the PWM is doing. My code basically works as expected with one very important catch.
The Problem
After anywhere from a couple seconds to 10-20 seconds, the LEDs stop responding to control from the XBox 360 controller. Based on debug print statements I added (not in the code below) I know the loop keeps going and
Xbox.Xbox360Connected = true
, but thatLeftHatXCurr = Xbox.getAnalogHat(LeftHatX);
is stuck on the same value instead of reflecting the way I manipulate the left hat. This continues for 3-10 seconds, sometimes longer, and then without my resetting or doing anything, everything works as expected again. It's possible I'm doing (or failing to do) something to cause this, so please take a look at my code and let me know whether I'm at fault or maybe there's something else at play.The Code
The text was updated successfully, but these errors were encountered: