USBJoystick--why pin 4?

I'm using the USBJoystick library to provide a HID device controlled by the Arduino, which is good fun. Now, the USBKeyboard library used pins 2 and 3, since evidently pin 2 is necessary (interrupt?). But USBJoystick used pin 4 rather than pin 3. The only difference I can see is that pin 3 is marked as "PWM", but would that matter for this? Is there a reason to use pin 4 instead of pin 3, or was it an arbitrary change?

This is just a guess so shoot if I am wrong but I assume it is so you can use both at the same time.

How do you mean? (Not trying to be a weenie, just genuinely confused). Are pins 2 and 3 connected somehow so that you can't use them at the same time? Or just meaning that someone might want to use pin 3 (a PWM pin) at the same time as the USBJoystick and so used pin 4 instead?

(The real point of all this is that I'm trying to build/etch a little shield that uses a modified USBJoystick library; right now it's on pins 2 and 3, and I want to make sure that's OK. It seems to be working, but it's my first Arduino project and I'm flailing a lot here).

How do you mean?

Using a joy stick at the same time as a keyboard.

Hm; guessing that's not it, though, since if you had two USB out devices you wouldn't want to share pin 2 with them, and if you were just doing multiple devices on the same port you wouldn't need to swap lines.

Unless the shared pin was an output.

Hi,

I wrote/integrated the original USBKeyboard code (I assume you're referring to the code I wrote) and someone else modified it to work with mouse and joystick.

I believe the pins changed because the person who modified it needed the pins for something else (433MHz communications I think) I can't remember if I read that on the blog or on an email.

I seem to recall I considered changing the pins also but I can't remember why. :slight_smile:

It should work on either.

--Phil.

P.S. Cool to see someone else using the code. :smiley:

Thanks, follower. It SEEMS to be working... I'm using it to make a "hardware driver" for an old 1996 rs232 serial game controller (SpaceOrb 360) into a hot-pluggable HID device. Works like a champ (played an entire session of "Left4Dead" with it) so now I'm on to making a board and just want to make sure I'm not missing something horribly important. Designed my (horrible) PCB in eagle; going to try etching this week-end.