I'm using a Arduino Leonardo with a b10k pot. I want to have this pot act as a gamepad (paddle) in a HTML-game. I'm using ArduinoJoystickLibrary and mapping the analog value(0-1023) to a range of -127 to 127.
Like this:
Joystick[0].setXAxis(map(analogRead(A0), 0, 1023, -127, 127));
Windows 7 is is happy with this and if I run 'Set up USB controllers' and test the device is responds perfect from edge to edge. So far so good, seems like I have made myself a perfectly working USB joystick with one axis.
When testing the device for a HTML5 Gamepad (here) (and here) I get INFINITY and -INFINITY for the x-axis.
My problem is now that the HTML5 Gamepad Api expects a range from -1 to 1.
Any ideas how I can get my Arduino Joystick to play well with the HTML5 gamepad spec?