Arduino UNO - Joystick

Hey, Here's the general idea: I want to read 4 analog sensors (in this case bendsensors, they could change to potentiometers or something else) Using the new chip on the UNO and some LUFA magic, (ant.b?) I would like to "present" the data to the computer as Joystick axes. Does the usb joystick specification permit sending 4 different 0-1024 ranged values? So far, Jim

Does the usb joystick specification permit sending 4 different 0-1024 ranged values?

This is an Arduino issue?

I ask because in the discussion I saw happening here, It seemed as only four states "up, down, left, right" are being sent, Not so much the position on x/y-axes.

So, it's a "using-arduino-as-usb-hid-controller" type of issue as far as I can see. (And probably some-one with some knowledge of the workings of the LUFA project can help me out.)

Cheers, Jim

Does the usb joystick specification permit sending 4 different 0-1024 ranged values?

Yes.

If you look at the LUFA joystick example, it's set up as an analogue joystick with a range of -100 to 100. Although the code only sends values of -100, 0 and 100 there's nothing to stop you sending any value in between.

The tricky bit is communicating the analogue data from 328 to 8u2. The only connection between the 2 is the USART. You need to get the 328 to encode the data somehow (easy) then get the 8u2 to decode it (harder). The 8u2 has very little program space and most of it is taken up by LUFA, so there is hardly any space left. Make the encoding scheme as easy to decode as you possibly can.

Getting 4 axes at 10 bits involves changing the report descriptor. I'd start off by trying to get 2 axes at 8 bits working first.

8 Bits of precision (200 'steps'?) is enough. But four seperate axes are definatly needed. Would the Arduino-USB library and Hardware be able to help in a more simple way? -> http://code.rancidbacon.com/ProjectLogArduinoUSB