Unojoy with more axes than default

Hello everyone!
I am trying to configure unojoy to have more axes than default (4 axes- x,y,z,z rotate) by following this guide : https://code.google.com/p/unojoy/wiki/ExtendingUnoJoy . I am building the project with Avr Studio 6. I have attached all the necessary files (tried to paste them here but exceeded the maximum characters allowed).
When I build this I have 6 axes on the gamepad’s properties but x_rotate and y_rotate act as buttons when I attach any pots to them -axes remain still (x,y,z,z_rotate work fine).
If anyone could give me some guidelines on how to implement this , that would be much appreciated!
Thank you in advance

usb_gamepad.h (4.33 KB)

usb_gamepad.c (21.3 KB)

dataForController_t.h (1.11 KB)

UnoJoyArduinoSample.ino (2.19 KB)

This is the Unojoy.h that UnojoyArduinoSample works with

UnoJoy.h (9.76 KB)

In your sketch you have 2 analogue pins set up as high digital inputs, I’m using the same code and I have a 48 axis joystick, I’ll have a look at your other files.

I also edited physicalButtonList_t.h (I’m not sure how important it is), other than that I think you have it.

void setupPins(void){
  // Set all the digital pins as inputs
  // with the pull-up enabled, except for the 
  // two serial line pins
  for (int i = 2; i <= 12; i++){
    pinMode(i, INPUT);
    digitalWrite(i, HIGH);
  }
  pinMode(A4, INPUT);  // delete this
  digitalWrite(A4, HIGH); // delete this
  pinMode(A5, INPUT); // delete this
  digitalWrite(A5, HIGH); // delete this
}

There’s also this where you ask for a digital read of A4 & A5

dataForController_t controllerData = getBlankDataForController();
  // Since our buttons are all held high and
  //  pulled low when pressed, we use the "!"
  //  operator to invert the readings from the pins
  controllerData.triangleOn = !digitalRead(2);
  controllerData.circleOn = !digitalRead(3);
  controllerData.squareOn = !digitalRead(4);
  controllerData.crossOn = !digitalRead(5);
  controllerData.dpadUpOn = !digitalRead(6);
  controllerData.dpadDownOn = !digitalRead(7);
  controllerData.dpadLeftOn = !digitalRead(8);
  controllerData.dpadRightOn = !digitalRead(9);
  controllerData.l1On = !digitalRead(10);
  controllerData.r1On = !digitalRead(11);
  controllerData.selectOn = !digitalRead(12);
  controllerData.startOn = !digitalRead(A4);   // Delete this
  controllerData.homeOn = !digitalRead(A5);  // Delete this

What is your ultimate aim? I maybe able to help, (mine has 128 buttons & 48 pots but I want another 32 pots)

Thanks for reply!
I managed to fix it although I don’t remember the exact solution was long time ago !
Why you need so many analog sticks by the way ? What are you building?Just asking :slight_smile:

I'm building a HID dj controller, the dj software takes any HID and unojoy was the easiest option, but alas I can't go higher than 64 bytes so I'm trying a LUFA version now.

Sorry I didn't spot your post earlier it was perhaps the only thing I could help somebody with on here.

Post more information on what you are building if you like!
I d love to hear more on this project!
Cheers

Hi, I take this very old topic for ask you an help forn Unojoy with six axes.
I tried the Crhis89's sketch with the correction of locodog (I deleted the indicate lines), but my "Unojoy Joystick" have only four axes (A0, A1, A2 and A3), can you tell me how I must proced for have six axes?
Thanks and ciao