Isaac96/unojoy

MegaJoy Analog function not reading correctly in Win7

Opened this issue · 4 comments

I installed MegaJoy successfully(?) in Windows 7 64-bit and my Arduino Mega 
2560 R3.

Windows sees the axis and buttons in both virtual joysticks as "UnoJoy 
Joystick" (devices and printers).

To test the analog controller input, I put a potentiometer along the analog 
input side of the Mega (A0 to A15).

In A0, Windows (Game Controllers -> UnoJoy properties) shows the x-axis / 
y-axis (the open box) scroll across the top left/right as I move the 
potentiometer.

A1 to A5 does nothing.

When I connect the potentiometer to A6 to A15 and setup virtual joystick 2 
properties, all axis (plural) move as I turn the pot. So, the x/y axis box 
moves diagonal top-left to bottom-right, the z-axis, x- and y- and z- rotation 
bars move from left to right at one time.

What I would like to do is use A1 as one axis (let's say x-rotation), A2 as 
another axis (y-rotation)...etc.  To be able to isolate the potentiometer for 
one axis or rotation.

Original issue reported on code.google.com by MikeB1...@gmail.com on 9 Apr 2014 at 2:31

Have you tried connecting the unused analog pins to ground? From first glance, 
it sounds like the common problem where, since the ADC is shared by all the 
analog input pins, if the other pins are left floating, the ADC will still have 
the residual voltage left from the pin connected to the pot, and will report 
that for all subsequent reads.

Not sure what's up with A1-A5; I'll try and poke around with that a bit 
tomorrow, but try connecting the unused pins to ground, and if you don't want 
to use them in your application, you can set the unused axes to 128 instead of 
an analogRead.

Original comment by alan.chatham@gmail.com on 9 Apr 2014 at 4:23

Thanks Alan!  I will try grounding the pins and get back to you here.

Original comment by MikeB1...@gmail.com on 9 Apr 2014 at 4:52

I have the same problem: I attached 6 analog joystick from A0 to A11;
A0,A6-A11 work properly, A1-A5 do nothing. I have tried to invert the joystick 
but is the same. I have win7 64 bit. No errors during installation. The buttons 
work propely

Original comment by andrea.o...@gmail.com on 14 Sep 2014 at 3:26

I found a solution, in the sketch the axis 1-5 aren't setted to analog input 
A1-A5 but with a fixed value. I deleted fixed value and uncommented the 
analogpin(1-5).

Bye

Original comment by andrea.o...@gmail.com on 28 Nov 2014 at 6:05