Author Topic: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)  (Read 104992 times)

0 Members and 1 Guest are viewing this topic.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #250 on: Mon, 14 December 2015, 18:51:13 »
Downloaded Arduinio 1.6.5, swapped USB files and the sketch compiled.  Found a program similar to xpadder (QJoyPad) and my analog now types some letters - handy...

Swapping the analog to the "digitised" pins resulted in no buttons pressed, so it's definitely a software problem, but one I can't fix now as it's bedtime :(
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #251 on: Tue, 15 December 2015, 07:12:40 »
Antimicro is another alternative to XPadder on Linux.

Offline W11cE

  • Posts: 23
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #252 on: Wed, 16 December 2015, 14:01:59 »
Sorry, im a little late to the coding party. What is the current status?

Here is a code for teensy for one joystick in joystick mode and one joystick as a hat + those earlier buttons:
Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X 2
#define HAT_Y 3


#define OVERVAL 0

int Xstick;
int Ystick;

int Xhat;
int Yhat;
const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
for (int i = 0 ; i < 8 ; i++)
{
pinMode(myPins[i], INPUT_PULLUP);
}

//Serial.begin(9600);
//Serial.println("Joystick ready");
Joystick.useManualSend(true);
}

void loop()
{
// X axis computations
Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
Xstick = constrain(Xstick, 0, 1023);
Joystick.X(Xstick);

// Y axis computations
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
Ystick = constrain(Ystick, 0, 1023);
Joystick.Y(Ystick);

for (int i = 0 ; i < 8 ; i++)
{
buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
{
Joystick.button(i + 1, !buttonState[i]);
oState[i] = buttonState[i];   // save state to compare next time
}
}

//HAT
Xhat = analogRead(HAT_X);
Yhat = analogRead(HAT_Y);

if(Xhat <= center + hatThreshold &&
Xhat >= center - hatThreshold &&
Yhat <= center + hatThreshold &&
Yhat >= center - hatThreshold)
Joystick.hat(-1);
else
{
if(Yhat >= center + hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(45);
else if(Xhat <= center - hatThreshold)
Joystick.hat(315);
else
Joystick.hat(0);
}
else if(Yhat <= center - hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(135);
else if(Xhat <= center - hatThreshold)
Joystick.hat(225);
else
Joystick.hat(180);
}
else if(Xhat <= center - hatThreshold)
Joystick.hat(270);
else
Joystick.hat(90);
}


// Update joystick state
Joystick.send_now();
}

I tested this on Teensy LC with vita stick.
« Last Edit: Wed, 16 December 2015, 14:16:33 by W11cE »

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #253 on: Wed, 16 December 2015, 18:36:22 »
Sorry, im a little late to the coding party. What is the current status?

Status is apparently the Teensy doesn't play nice with xpadder but your code works fine with my Linux replacement, so hopefully that's not true.

The other problem is "digitising" an analog stick to just press buttons when pushed past a threshold.  Reading your code I had a brainwave - mine was based on raw values not mapped like the axes are, but this improved code still doesn't work despite printing values of 57 and -68 (my analog is not a nice accurate vita one )  If you could tell me what really important thing I'm missing before I go mad that would be great :))  (This is back on Arduino as my Teensy has no breadboard friendly pins)

Code: [Select]
Temp= map(analogRead(5), OVERVAL, 1024 - OVERVAL, -127, 127);
Serial.println(Temp)
(Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
(Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #254 on: Wed, 16 December 2015, 20:13:43 »
STATUUUUUUUUUUS ;D

yeah, unfortunately i couldn't get teensy to output to xpadder on 2 PCs running as administrator on USB 2.0

i would like to use the teensy.  but since xpadder is critical to the project, i had to go back to planning for the leonardo.

i've gotten the handset mostly ready to be wired up in prior posts.

and i've got the long-run of wires to connect handset and leonardo project box prepared to be organized with wire braid and heat shrink tube.

just yesterday i got the leonardo ready to be wired up:

120304-0

so, cabling is nearly done.

as soon as i get the strength, i'm going to try the new code in the teensy just to see if it somehow causes teensy output to show up in xpadder.  but i don't think it will.  went kiteboarding today and probably won't be doing much away from bed this evening ^-^

i'll confirm the new code still doesn't work with xpadder as soon as i can. 

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #255 on: Thu, 17 December 2015, 14:04:40 »
Sorry, im a little late to the coding party. What is the current status?

Here is a code for teensy for one joystick in joystick mode and one joystick as a hat + those earlier buttons:
Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X 2
#define HAT_Y 3


#define OVERVAL 0

int Xstick;
int Ystick;

int Xhat;
int Yhat;
const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
for (int i = 0 ; i < 8 ; i++)
{
pinMode(myPins[i], INPUT_PULLUP);
}

//Serial.begin(9600);
//Serial.println("Joystick ready");
Joystick.useManualSend(true);
}

void loop()
{
// X axis computations
Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
Xstick = constrain(Xstick, 0, 1023);
Joystick.X(Xstick);

// Y axis computations
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
Ystick = constrain(Ystick, 0, 1023);
Joystick.Y(Ystick);

for (int i = 0 ; i < 8 ; i++)
{
buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
{
Joystick.button(i + 1, !buttonState[i]);
oState[i] = buttonState[i];   // save state to compare next time
}
}

//HAT
Xhat = analogRead(HAT_X);
Yhat = analogRead(HAT_Y);

if(Xhat <= center + hatThreshold &&
Xhat >= center - hatThreshold &&
Yhat <= center + hatThreshold &&
Yhat >= center - hatThreshold)
Joystick.hat(-1);
else
{
if(Yhat >= center + hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(45);
else if(Xhat <= center - hatThreshold)
Joystick.hat(315);
else
Joystick.hat(0);
}
else if(Yhat <= center - hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(135);
else if(Xhat <= center - hatThreshold)
Joystick.hat(225);
else
Joystick.hat(180);
}
else if(Xhat <= center - hatThreshold)
Joystick.hat(270);
else
Joystick.hat(90);
}


// Update joystick state
Joystick.send_now();
}

I tested this on Teensy LC with vita stick.

with this sketch, xpadder recognizes output from teensy on buttons and hat  :eek: i'll do more testing as soon as i can.  i may have to switch back to planning for teensy implementation rather than leonardo :-X

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #256 on: Thu, 17 December 2015, 15:13:45 »
xpadder still won't recognize analog input on A0-A1 for x axis / y axis >:D

with this sketch, the windows 7 game controller properties see the analog x axis / y axis, but nothing shows up in xpadder although it does see buttons and the hat.

i googled around and found nothing helpful about what to do when xpadder doesn't see an analog input.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #257 on: Thu, 17 December 2015, 15:19:39 »
Okay, I got it to work :thumb:

Xpadder won't autodetect analog input from the teensy, but it will detect it if it's manually set up :))

So, at this point I'm going to resume planning to implement the teensy :cool:

Could somebody add one more analog stick to this sketch in a way such that it activates buttons 9 through 13?

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #258 on: Thu, 17 December 2015, 15:25:18 »
If it can reassure you, I spent the whole day fighting with character encoding at work ... with no luck. Just can't understand why the hell, in 2015, industry giants doesn't support UTF-8 and extended charset as a standard.

I have ordered small Atmage32U4 boards so I'll soon be able to unplug my Teensy from my keyboard and help you a little more.

Offline W11cE

  • Posts: 23
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #259 on: Thu, 17 December 2015, 17:25:12 »
Sorry, im a little late to the coding party. What is the current status?

Status is apparently the Teensy doesn't play nice with xpadder but your code works fine with my Linux replacement, so hopefully that's not true.

The other problem is "digitising" an analog stick to just press buttons when pushed past a threshold.  Reading your code I had a brainwave - mine was based on raw values not mapped like the axes are, but this improved code still doesn't work despite printing values of 57 and -68 (my analog is not a nice accurate vita one )  If you could tell me what really important thing I'm missing before I go mad that would be great :))  (This is back on Arduino as my Teensy has no breadboard friendly pins)

Code: [Select]
Temp= map(analogRead(5), OVERVAL, 1024 - OVERVAL, -127, 127);
Serial.println(Temp)
(Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
(Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;

It could be this:
Code: [Select]
(Temp < -30)In "real" C world this would be ok, but Im not sure if the arduino compilers like this.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #260 on: Thu, 17 December 2015, 17:34:12 »
Glad to hear the Teensy works, mine has no pins so I can't test this code but I've attempted to add the extra stick using the same style of code that doesn't work on the Arduino and it compiles...  I don't hold much hope but it's worth a try!

Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X   2
#define HAT_Y   3

#define DIGI_X  4
#define DIGI_Y  5


#define OVERVAL 0

int Xstick;
int Ystick;

int Xhat;
int Yhat;

int Xdigi;
int Ydigi;

const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
  for (int i = 0 ; i < 8 ; i++)
  {
    pinMode(myPins[i], INPUT_PULLUP);
  }

  //Serial.begin(9600);
  //Serial.println("Joystick ready");
  Joystick.useManualSend(true);
}

void loop()
{
  // X axis computations
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
  Xstick = constrain(Xstick, 0, 1023);
  Joystick.X(Xstick);

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
  Ystick = constrain(Ystick, 0, 1023);
  Joystick.Y(Ystick);

  // Digitised stick computations
  Xdigi = map(analogRead(DIGI_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
  (Xdigi < -30) ? buttonState[9] = 1 : buttonState[9] = 0;
  (Xdigi > 30) ? buttonState[10] = 1 : buttonState[10] = 0;
     
  Ydigi = map(analogRead(DIGI_Y), OVERVAL, 1024 - OVERVAL, 0, 1023);
  (Ydigi < -30) ? buttonState[11] = 1 : buttonState[11] = 0;
  (Ydigi > 30) ? buttonState[12] = 1 : buttonState[12] = 0;

  for (int i = 0 ; i < 8 ; i++)
  {
    buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
    if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
    {
      Joystick.button(i + 1, !buttonState[i]);
      oState[i] = buttonState[i];   // save state to compare next time
    }
  }

  //HAT
  Xhat = analogRead(HAT_X);
  Yhat = analogRead(HAT_Y);
 
  if(Xhat <= center + hatThreshold &&
  Xhat >= center - hatThreshold &&
  Yhat <= center + hatThreshold &&
  Yhat >= center - hatThreshold)
  Joystick.hat(-1);
  else
  {
    if(Yhat >= center + hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(45);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(315);
      else
        Joystick.hat(0);
    }
    else if(Yhat <= center - hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(135);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(225);
      else
        Joystick.hat(180);
    }
    else if(Xhat <= center - hatThreshold)
      Joystick.hat(270);
    else
      Joystick.hat(90);
  }


  // Update joystick state
  Joystick.send_now();
}
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline W11cE

  • Posts: 23
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #261 on: Thu, 17 December 2015, 17:39:32 »
Okay, I got it to work :thumb:

Xpadder won't autodetect analog input from the teensy, but it will detect it if it's manually set up :))

So, at this point I'm going to resume planning to implement the teensy :cool:

Could somebody add one more analog stick to this sketch in a way such that it activates buttons 9 through 13?

Here:
Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X 2
#define HAT_Y 3

#define HAT2_X 4
#define HAT2_Y 5

//Buttons
#define HAT2_UP 9
#define HAT2_RIGHT 10
#define HAT2_DOWN 11
#define HAT2_LEFT 12




#define OVERVAL 0


int Xstick;
int Ystick;

int Xhat;
int Yhat;
int Xhat2;
int Yhat2;
const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
for (int i = 0 ; i < 8 ; i++)
{
pinMode(myPins[i], INPUT_PULLUP);
}

//Serial.begin(9600);
//Serial.println("Joystick ready");
Joystick.useManualSend(true);
}

void loop()
{
// X axis computations
Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
Xstick = constrain(Xstick, 0, 1023);
Joystick.X(Xstick);

// Y axis computations
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
Ystick = constrain(Ystick, 0, 1023);
Joystick.Y(Ystick);

for (int i = 0 ; i < 8 ; i++)
{
buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
{
Joystick.button(i + 1, !buttonState[i]);
oState[i] = buttonState[i];   // save state to compare next time
}
}

//HAT
Xhat = analogRead(HAT_X);
Yhat = analogRead(HAT_Y);

if(Xhat <= center + hatThreshold &&
Xhat >= center - hatThreshold &&
Yhat <= center + hatThreshold &&
Yhat >= center - hatThreshold)
Joystick.hat(-1);
else
{
if(Yhat >= center + hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(45);
else if(Xhat <= center - hatThreshold)
Joystick.hat(315);
else
Joystick.hat(0);
}
else if(Yhat <= center - hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(135);
else if(Xhat <= center - hatThreshold)
Joystick.hat(225);
else
Joystick.hat(180);
}
else if(Xhat <= center - hatThreshold)
Joystick.hat(270);
else
Joystick.hat(90);
}

//HAT2
Xhat2 = analogRead(HAT2_X);
Yhat2 = analogRead(HAT2_Y);

if(Xhat2 <= center + hatThreshold &&
Xhat2 >= center - hatThreshold &&
Yhat2 <= center + hatThreshold &&
Yhat2 >= center - hatThreshold)
hatWithButtons(-1);
else
{
if(Yhat2 >= center + hatThreshold){
if(Xhat2 >= center + hatThreshold)
hatWithButtons(45);
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(315);
else
hatWithButtons(0);
}
else if(Yhat2 <= center - hatThreshold){
if(Xhat2 >= center + hatThreshold)
hatWithButtons(135);
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(225);
else
hatWithButtons(180);
}
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(270);
else
hatWithButtons(90);
}


// Update joystick state
Joystick.send_now();
}

void hatWithButtons(int val){
switch(val){
case -1:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 0:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 45:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 90:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 135:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 0);
break;
case 180:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 0);
break;
case 225:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 1);
break;
case 270:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 1);
break;
case 315:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 1);
break;
}
}

I compiled it, but didn't test with a joystick.

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #262 on: Thu, 17 December 2015, 17:46:48 »
It could be this:
Code: [Select]
(Temp < -30)In "real" C world this would be ok, but Im not sure if the arduino compilers like this.

Ternary operator works in Arduino Sketches, I've been using it in the past. The code below is a simple example running on my Atmega2560

Code: [Select]
int temp = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  //Serial.println("Joystick ready");
}

void loop() {
  // put your main code here, to run repeatedly:
  temp += 1;
  (temp < 5) ? Serial.println("low") : Serial.println("high");
  delay(1000);
}

Serial output

Code: [Select]
low
low
low
low
low
high
high
high

You can even write something like this:

Code: [Select]
IsLEDOn = !IsLEDOn; // toggle value of IsLEDOn
digitalWrite(LEDPin, IsLEDOn ? HIGH : LOW)

Maybe the problem has more to do with the use of 0 / 1 instead of true / false for the buttonState.
Code: [Select]
(Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
(Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;
« Last Edit: Thu, 17 December 2015, 18:36:03 by GuilleAcoustic »

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #263 on: Thu, 17 December 2015, 19:36:28 »

Here:
Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X 2
#define HAT_Y 3

#define HAT2_X 4
#define HAT2_Y 5

//Buttons
#define HAT2_UP 9
#define HAT2_RIGHT 10
#define HAT2_DOWN 11
#define HAT2_LEFT 12




#define OVERVAL 0


int Xstick;
int Ystick;

int Xhat;
int Yhat;
int Xhat2;
int Yhat2;
const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
for (int i = 0 ; i < 8 ; i++)
{
pinMode(myPins[i], INPUT_PULLUP);
}

//Serial.begin(9600);
//Serial.println("Joystick ready");
Joystick.useManualSend(true);
}

void loop()
{
// X axis computations
Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
Xstick = constrain(Xstick, 0, 1023);
Joystick.X(Xstick);

// Y axis computations
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
Ystick = constrain(Ystick, 0, 1023);
Joystick.Y(Ystick);

for (int i = 0 ; i < 8 ; i++)
{
buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
{
Joystick.button(i + 1, !buttonState[i]);
oState[i] = buttonState[i];   // save state to compare next time
}
}

//HAT
Xhat = analogRead(HAT_X);
Yhat = analogRead(HAT_Y);

if(Xhat <= center + hatThreshold &&
Xhat >= center - hatThreshold &&
Yhat <= center + hatThreshold &&
Yhat >= center - hatThreshold)
Joystick.hat(-1);
else
{
if(Yhat >= center + hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(45);
else if(Xhat <= center - hatThreshold)
Joystick.hat(315);
else
Joystick.hat(0);
}
else if(Yhat <= center - hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(135);
else if(Xhat <= center - hatThreshold)
Joystick.hat(225);
else
Joystick.hat(180);
}
else if(Xhat <= center - hatThreshold)
Joystick.hat(270);
else
Joystick.hat(90);
}

//HAT2
Xhat2 = analogRead(HAT2_X);
Yhat2 = analogRead(HAT2_Y);

if(Xhat2 <= center + hatThreshold &&
Xhat2 >= center - hatThreshold &&
Yhat2 <= center + hatThreshold &&
Yhat2 >= center - hatThreshold)
hatWithButtons(-1);
else
{
if(Yhat2 >= center + hatThreshold){
if(Xhat2 >= center + hatThreshold)
hatWithButtons(45);
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(315);
else
hatWithButtons(0);
}
else if(Yhat2 <= center - hatThreshold){
if(Xhat2 >= center + hatThreshold)
hatWithButtons(135);
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(225);
else
hatWithButtons(180);
}
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(270);
else
hatWithButtons(90);
}


// Update joystick state
Joystick.send_now();
}

void hatWithButtons(int val){
switch(val){
case -1:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 0:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 45:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 90:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 135:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 0);
break;
case 180:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 0);
break;
case 225:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 1);
break;
case 270:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 1);
break;
case 315:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 1);
break;
}
}

I compiled it, but didn't test with a joystick.

this works :thumb:

i just need to know how to adjust the nullzone.  when using analog sticks for digital input, it needs a large nullzone to be able to activate one button at a time.

i'm guessing it must be this group of numbers:
Code: [Select]
{
    if(Yhat >= center + hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(45);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(315);
      else
        Joystick.hat(0);
    }
    else if(Yhat <= center - hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(135);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(225);
      else
        Joystick.hat(180);
    }
    else if(Xhat <= center - hatThreshold)
      Joystick.hat(270);
    else
      Joystick.hat(90);
  }

i need to know the ranges of how i can adjust these in order to enlarge the nullzone.  i'm guessing 2 of them have to be bigger?

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #264 on: Thu, 17 December 2015, 22:12:01 »
seems teensy will work very well here :cool:
120412-0

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #265 on: Fri, 18 December 2015, 02:03:41 »
The hatThreshold constant is the null zone for the hat. Anything inside a square of 2x hatThreshold size, centered around "center", is considered NULL.

You can replicate this for the digitized joystick. Since analogRead() return à value ranging from 0 to 1024, with 512 being the center, your threshold must be between 0 and 512. The bigger the threshold, the bigger the null zone.

Maybe you could try to compute the linear distance between the center and your position, instead of comparing toward axis position. This would result in a circular null zone instead of a square one. Dunno which one would work the best or be the more comfy. Depends on your gaming style (circular motion) and null zone size I guess.

« Last Edit: Fri, 18 December 2015, 04:15:14 by GuilleAcoustic »

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #266 on: Fri, 18 December 2015, 14:17:56 »
The hatThreshold constant is the null zone for the hat. Anything inside a square of 2x hatThreshold size, centered around "center", is considered NULL.

Maybe you could try to compute the linear distance between the center and your position, instead of comparing toward axis position.

ok, so i just need to make the 128 bigger and test for the desired nullzone :thumb:

the way it's coded is with a square nullzone?  i didn't realize that.  square is actually ideal for digital use because of how it minimizes the chance of inadvertent keypresses due to imperfect movement.


Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #267 on: Fri, 18 December 2015, 14:26:15 »
update

got switches soldered up. they work.  felt like a real milestone ;D

teensy has indeed made remaining work much easier so far :cool: 

soldering the switches up was so easy
120492-0

120494-1

a shot of the desk that was clean and spiraled into a careless workspace.  i find it funny ^-^

120496-2

W11cE has ordered parts for 2 more analog mods. payment has been made. 

celebrating progress :thumb:

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #268 on: Fri, 18 December 2015, 14:29:51 »
Maybe the problem has more to do with the use of 0 / 1 instead of true / false for the buttonState.
Code: [Select]
(Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
(Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;

How annoying would that be!  What kind of pedantic language doesn't accept binary booleans :confused:

I shall try it asap...

The hatThreshold constant is the null zone for the hat. Anything inside a square of 2x hatThreshold size, centered around "center", is considered NULL.

Maybe you could try to compute the linear distance between the center and your position, instead of comparing toward axis position.

ok, so i just need to make the 128 bigger and test for the desired nullzone :thumb:

the way it's coded is with a square nullzone?  i didn't realize that.  square is actually ideal for digital use because of how it minimizes the chance of inadvertent keypresses due to imperfect movement.

Yup, default is square as you have to pass the value on one axis for it to count, to do a round one you'd have to do something like adding the axes if they were both between a smaller square and a definitely activated value - more complicated!
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #269 on: Fri, 18 December 2015, 22:39:22 »
pickup tests.

device very easy to pickup and carry or pick up in play position without hitting keys :thumb:


Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #270 on: Sat, 19 December 2015, 22:55:04 »
Big day with the controller today :)

It's been since just before I started this thread in mid August that I played league of legends. Today I finally got to somewhat come out of retirement and actually play the game. Obviously, for this project, it's a pretty big step :p

What I did was, I just wired up the single analog stick that I have, and with that and my eight buttons I was able to play with basic functionality. Nothing fancy, no laughs, dances, or even the ability to ward or level up my abilities with hot keys. Just basic functionality of movement, basic attacks, all four abilities, and awesome camera control :cool:

I spent the whole day playing on and off, figuring out which basic commands I can map to the limited controls I have at this time and essentially having to relearn how to play this game with a totally new control scheme for about the sixth or seventh time. With this version of that activity one of the more demanding since I'm having to newly learn to use this controller, and having to learn to play league of legends with a pen tablet, and having everything be switched from left to right :confused:

This kind of relearning of the game and all the establishing of new muscle memory is nothing new for me, and by the end of the day I could basically play the game somewhat normally. This process usually takes a full week for me to be able to regain the entirety of my prior abilities. 

At any rate, the good news is that the device works phenomenally. I'm not sure yet because I'm still making some adjustments, but I'm pretty sure it's the best controller I've ever used :thumb:

In the course of making observations and experiencing various things during gameplay, I discovered that the device is not best as a knee or thigh device. Rather, this device finds itself more at home on the chest/belly. Although I wasn't expecting it, this wasn't a big surprise to me as I have previously played with a Logitech M570 in the same position on my chest along with the razor orbweaver on my belly. if you're a sofa or bed gamer, chest and belly is often the home of a device of some sort due to the corpse like position you can assume - elbows bent with zero muscles firing aside from fingers and thumb - which is probably the most ergonomic position the human body can get into :))

At any rate, this is what I mean by the position in which the device finds itself most at home.
120737-0

at least for me because of how i game in a zero gravity chair which has me fairly well laid out like a corpse, it works well to somewhat assume the figure of a corpse for maximum comfort.

by re-purposing the device as a chest rather than thigh device, i found the effort required of the wrist and forearm to dramatically plummet.  the device was darned comfortable and easy to use on my thigh, but once i dropped it on my chest, just laid on its face rather than propped up on its base, and felt the difference in how little was required of small muscle groups for stability and leverage to hit keys, i knew a change had to be made.

the change required is a swinging outward of the outside leg by about 15 degrees or something.  the reason it's needed is that when i lay the device on my chest, my finger positions get rotated clockwise out of the device enough to make wrong the position of the outside leg and the keys affixed to it (my fingers are not inserted as deeply into the device - their grip is relaxed more and they just don't go as deep).

this means a major teardown, probably the 10th at this point. 
 
i've taken these pics as reference for my keycap orientations:
120739-1
120741-2

have removed the analog stick on top and proceeded with major teardown
120743-3

i've made a new cut as you can see which allows for repositioning the angle of the outside leg such that it better faces the backs of my fingers' 2nd segments now that they have moved due to the new chest/belly method of use.

you can see the original angel on bottom line cut, and the new angle to be in the top line cut.  i'll reassemble with sugru tomorrow.
120745-4
« Last Edit: Sat, 19 December 2015, 22:57:03 by Camineet »

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #271 on: Sun, 20 December 2015, 03:43:21 »
That's great to read - fun as building this is supposed to be by the 10th rebuild it's surely getting tedious but you'll have fresh motivation to finish it now.  I'm surprised you can use it so quickly but sounds like you have lots of experience :)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Bucake

  • Posts: 945
  • Location: The Netherlands
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #272 on: Sun, 20 December 2015, 22:39:41 »
amazing progress!
IBM Model F XT // Realforce 87U 55g Type-S // HHKBP2 45g Type-S // KBT Pure Pro Cherry MX Red

Offline Camineet

  • Thread Starter
  • Posts: 287

Offline 3K

  • Posts: 279
  • Location: Germany
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #274 on: Mon, 21 December 2015, 17:07:53 »
Big day with the controller today :)

It's been since just before I started this thread in mid August that I played league of legends. Today I finally got to somewhat come out of retirement and actually play the game. Obviously, for this project, it's a pretty big step :p

What I did was, I just wired up the single analog stick that I have, and with that and my eight buttons I was able to play with basic functionality. Nothing fancy, no laughs, dances, or even the ability to ward or level up my abilities with hot keys. Just basic functionality of movement, basic attacks, all four abilities, and awesome camera control :cool:

I spent the whole day playing on and off, figuring out which basic commands I can map to the limited controls I have at this time and essentially having to relearn how to play this game with a totally new control scheme for about the sixth or seventh time. With this version of that activity one of the more demanding since I'm having to newly learn to use this controller, and having to learn to play league of legends with a pen tablet, and having everything be switched from left to right :confused:

This kind of relearning of the game and all the establishing of new muscle memory is nothing new for me, and by the end of the day I could basically play the game somewhat normally. This process usually takes a full week for me to be able to regain the entirety of my prior abilities. 

At any rate, the good news is that the device works phenomenally. I'm not sure yet because I'm still making some adjustments, but I'm pretty sure it's the best controller I've ever used :thumb:

In the course of making observations and experiencing various things during gameplay, I discovered that the device is not best as a knee or thigh device. Rather, this device finds itself more at home on the chest/belly. Although I wasn't expecting it, this wasn't a big surprise to me as I have previously played with a Logitech M570 in the same position on my chest along with the razor orbweaver on my belly. if you're a sofa or bed gamer, chest and belly is often the home of a device of some sort due to the corpse like position you can assume - elbows bent with zero muscles firing aside from fingers and thumb - which is probably the most ergonomic position the human body can get into :))

At any rate, this is what I mean by the position in which the device finds itself most at home.
(Attachment Link)

at least for me because of how i game in a zero gravity chair which has me fairly well laid out like a corpse, it works well to somewhat assume the figure of a corpse for maximum comfort.

by re-purposing the device as a chest rather than thigh device, i found the effort required of the wrist and forearm to dramatically plummet.  the device was darned comfortable and easy to use on my thigh, but once i dropped it on my chest, just laid on its face rather than propped up on its base, and felt the difference in how little was required of small muscle groups for stability and leverage to hit keys, i knew a change had to be made.

the change required is a swinging outward of the outside leg by about 15 degrees or something.  the reason it's needed is that when i lay the device on my chest, my finger positions get rotated clockwise out of the device enough to make wrong the position of the outside leg and the keys affixed to it (my fingers are not inserted as deeply into the device - their grip is relaxed more and they just don't go as deep).

this means a major teardown, probably the 10th at this point. 
 
i've taken these pics as reference for my keycap orientations:
(Attachment Link)
(Attachment Link)

have removed the analog stick on top and proceeded with major teardown
(Attachment Link)

i've made a new cut as you can see which allows for repositioning the angle of the outside leg such that it better faces the backs of my fingers' 2nd segments now that they have moved due to the new chest/belly method of use.

you can see the original angel on bottom line cut, and the new angle to be in the top line cut.  i'll reassemble with sugru tomorrow.
(Attachment Link)

That thing looks mean! Like a piece of Malphite. :D

Great to see the progress on this!

                   Model M '88    | Model M SSK '87 | HHKB P2  | Zowie FK1

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #275 on: Mon, 21 December 2015, 18:06:49 »

That thing looks mean! Like a piece of Malphite. :D

Great to see the progress on this!

lol.  hopefully it will be less mean looking when i can get it working completely and then have time to pretty it up a bit ;D

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #276 on: Wed, 23 December 2015, 00:15:50 »
121296-0
1st online game /w the controller :cool:  going 5 and 2 with Varus mid on my smurf account (the yellow name on top of player list) proves the viability of this design.  it seems to work as well as orbweaver for basic gameplay.  i still can only play the very basics due to the current stage of development (still just one analog stick), so i can't flash or ward, or any of the critical tactical and other extras beyond just basic fighting.  hoping the 2 additional analog sticks put this thing at the highest level of functionality available (or not available depending on if you have 5 months and probably 350 dollars to invest) :-[

of course, this was on my smurf account playing against noobs at like level 5.  players at this level are so bad, you can almost just sit back and wait for them to kill themselves :))

but still, these kills were legit with me at least somewhat responsible for each one.

so, very happy with the state of things.

new build that was done today is ugly as hell the way all new builds are, but the new angle of the outside leg gets me closer to being able to use this as a chest/belly device.  before i can set it up for play like that, i have to consider some feet to go on my chest/belly so the keys aren't so close to me that they rub my shirt when moved.  even after doing that, it looks like the device can still be used on thigh if wanting to change things up.  versatility might be nice although i'll probably settle into using it exclusively on chest/belly like a corpse the way i've used most devices.

when sugruing in the new angle of the outside leg, i also made the two legs pinch together more at the pinky finger end.  this allowed me to cut the weight of the device by over 30% due to much less required clay stacking in order to get proper key positions.  no pics of new build because it's just too early and hideous.  the wires are very unhappy with the new key positions (wires are now too long in some places, too short in others, sticking out and jammed in here and there)  And...

i discovered a crack in the elbow of the outside leg.  it's cracked all the way through, and the only thing holding the leg together was the clay >:D  so the device is on an overnight superglue.  i might need to get a piece of metal for the leg or something :(

anyway, playing the bot games (offline practice) the other day was totally unsatisfying as would be expected of playing an esport without the sport.  but today was a different story.  it was very nice to get one game in today after these near 5 months of benchwarming :thumb:


Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #277 on: Wed, 23 December 2015, 15:31:36 »
played 1 very fun game today and then had to get serious about the project again.  seems to be a near daily pattern at this point ^-^

more hard work today and i've created a lot more hard work to come.

it's now time to deal with the matter of reducing distance thumb has to be extended out of neutral/at-rest position.

historically, it has been 1.5" as pictured here:
121388-0

ideally, it would be more like .5" as here:

121390-1

i have just now done the biggest teardown ever by removing the icecream stick and primary leg.  reconstruction will require a lot of work involving steel rod to couple the parts back together in the same way that pins are used to create structure in the reconstruction of a badly broken leg.

i've ordred 1/16" steel rod for the rebuild. should arrive in a week.

this adjustment is necessary because the 1.5" distance pictured above is unacceptable as i predict RSI from it within 12 months of daily gaming :'(

i predict i'll be able to get the distance down to one inch or slightly less, which will hopefully eliminate potential RSI due to over-extension issues ;)

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #278 on: Tue, 29 December 2015, 23:13:01 »
About 10 hours of work during the past week.Tore down the device in order to remove a lot of material and resolve the thumb distancing problem :cool:
122151-0
122153-1
122155-2
Outside leg skeleton bone broke again so I had to fashion a new one :-\  Luckilly, I found a part of the plastic box with a corner bracer to cut out
122157-3
122159-4
122161-5

Got very good results after all the hard work, reducing the thumb distance to less than an inch :thumb:
122165-6
122163-7

Still need to do some adjustment work on the top to get the analog stick positioned perfectly, but it's much better now than before
« Last Edit: Tue, 29 December 2015, 23:14:35 by Camineet »

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #279 on: Wed, 30 December 2015, 06:18:38 »
I'm impressed that the wiring stays working through all these teardowns - good work!
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #280 on: Wed, 30 December 2015, 18:45:31 »
I'm impressed that the wiring stays working through all these teardowns - good work!

Thanks for the support pal ;D

The real miracle is that W11ce's ps vita mod hasn't broken with all of the beatings is taken.  I've always tried to be as gentle as possible with it, always on the edge of a heart attack while handling it and implementing it in new builds.

Finally, I recently gave it the sugru treatment.  I gently laid sugru into the board carefully so as to not crunch and break any of the connections.  Now the mod is fairly well impact resistant and I can rest much easier ^-^
122227-0

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #281 on: Wed, 30 December 2015, 19:07:28 »
122241-0

The controller works beautifully :D

I haven't found any unforeseen performance problems or significant limitations.  It has the performance I envisioned when originally conceiving of the design.  Pulling keys instead of pressing them down with an outstretched finger is in fact much easier on the fingers as I originally imagined.  And equally as pleasing, hitting the keys on the outside leg is as easy and natural as I had hoped. 

Today I rewired the analog stick so as to be an actual analog stick rather than as the hat for camera control.  I had the analog stick wired up to the pins associated with the hat until today just for testing purposes.  Now that the analog stick is actually set to analog and used for camera control, I'm getting near effortless camera control.

The PS Vita stick is such a fine piece of tech.  It has nearly no nullzone, and is super easy to depress.  You don't even have to really press it with your thumb, you can just feather it and get excellent camera control.

I still can't use anything more than the most basic controls in game, and therefore can't play against the skilled players in ranked or even on my primary account, or regain my previous ability level with only one analog stick (The game results pic above is again on my Smurf account).  But when the two additional PS Vita mods from W11cE arrive and are implemented, I should be able to.

Oh, and I have sorted out some cabling issues with the purchase of some USB extensions, and I am now able to use the device on my belly instead of held upright on my thigh.  Results are excellent as expected.  There is no play of any kind in the device now from hitting keys or using the analog stick because it's solidly anchored due to its weight and the amount of surface area resting on me.  Additionally, as mentioned before, playing like this  (in a zero gravity chair) is as close to being dead as you can get and still be gaming.  It's relaxing and pleasant :thumb:

The current build is terrifically ugly as I have not done any refinement work.  Only focusing on getting that thumb stick where I wanted it.  The keys are all facing suboptimal slightly wonky tilts because I haven't done the 30 minute job of refining their angles and tilts on this build, but the device still functions beautifully regardless.

I'm hoping not to have to do much in the way of teardowns going forward.  And once the additional PS Vita mods arrive from W11cE, I can hopefully look forward to making fine adjustments rather than major overhauls.

In the meantime, I am enjoying very much playing a couple of games in the evenings and couldn't be happier :))

Offline Camineet

  • Thread Starter
  • Posts: 287
Hey guys, need to trouble you for a little coding help if possible.

I'm trying to add just one more button to stick on top so I can use flash in game while i wait for W11cE's 2 additional ps vita mods to arrive.

The code I have been using these past few weeks which works is as follows

Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X   2
#define HAT_Y   3

#define HAT2_X  4
#define HAT2_Y  5

//Buttons
#define HAT2_UP   9
#define HAT2_RIGHT  10
#define HAT2_DOWN   11
#define HAT2_LEFT   12




#define OVERVAL 0


int Xstick;
int Ystick;

int Xhat;
int Yhat;
int Xhat2;
int Yhat2;
const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
  for (int i = 0 ; i < 8 ; i++)
  {
    pinMode(myPins[i], INPUT_PULLUP);
  }

  //Serial.begin(9600);
  //Serial.println("Joystick ready");
  Joystick.useManualSend(true);
}

void loop()
{
  // X axis computations
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
  Xstick = constrain(Xstick, 0, 1023);
  Joystick.X(Xstick);

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
  Ystick = constrain(Ystick, 0, 1023);
  Joystick.Y(Ystick);

  for (int i = 0 ; i < 8 ; i++)
  {
    buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
    if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
    {
      Joystick.button(i + 1, !buttonState[i]);
      oState[i] = buttonState[i];   // save state to compare next time
    }
  }

  //HAT
  Xhat = analogRead(HAT_X);
  Yhat = analogRead(HAT_Y);
 
  if(Xhat <= center + hatThreshold &&
  Xhat >= center - hatThreshold &&
  Yhat <= center + hatThreshold &&
  Yhat >= center - hatThreshold)
  Joystick.hat(-1);
  else
  {
    if(Yhat >= center + hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(45);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(315);
      else
        Joystick.hat(0);
    }
    else if(Yhat <= center - hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(135);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(225);
      else
        Joystick.hat(180);
    }
    else if(Xhat <= center - hatThreshold)
      Joystick.hat(270);
    else
      Joystick.hat(90);
  }
 
  //HAT2
  Xhat2 = analogRead(HAT2_X);
  Yhat2 = analogRead(HAT2_Y);
 
  if(Xhat2 <= center + hatThreshold &&
  Xhat2 >= center - hatThreshold &&
  Yhat2 <= center + hatThreshold &&
  Yhat2 >= center - hatThreshold)
  hatWithButtons(-1);
  else
  {
    if(Yhat2 >= center + hatThreshold){
      if(Xhat2 >= center + hatThreshold)
        hatWithButtons(45);
      else if(Xhat2 <= center - hatThreshold)
        hatWithButtons(315);
      else
        hatWithButtons(0);
    }
    else if(Yhat2 <= center - hatThreshold){
      if(Xhat2 >= center + hatThreshold)
        hatWithButtons(135);
      else if(Xhat2 <= center - hatThreshold)
        hatWithButtons(225);
      else
        hatWithButtons(180);
    }
    else if(Xhat2 <= center - hatThreshold)
      hatWithButtons(270);
    else
      hatWithButtons(90);
  }


  // Update joystick state
  Joystick.send_now();
}

void hatWithButtons(int val){
  switch(val){
    case -1:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 0:
      Joystick.button(HAT2_UP, 1);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 45:
      Joystick.button(HAT2_UP, 1);
      Joystick.button(HAT2_RIGHT, 1);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 90:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 1);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 135:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 1);
      Joystick.button(HAT2_DOWN, 1);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 180:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 1);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 225:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 1);
      Joystick.button(HAT2_LEFT, 1);
      break;
    case 270:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 1);
      break;
    case 315:
      Joystick.button(HAT2_UP, 1);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 1);
      break;
  }
}

I've tried making adjustments to the code by just incrementally adding one digit to the following lines of code as follows in these two places, but got no results at all with the button wired up to pin eight.

from:

Code: [Select]
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7};
to:

Code: [Select]
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7, 8};


and from:

Code: [Select]
for (int i = 0 ; i < 8 ; i++)
to:

Code: [Select]
for (int i = 0 ; i < 9 ; i++)
That was just my best guess as to how to add one more button to the code after the first eight which use pins zero through seven.  But of course, I really don't have any coding ability and I'm just guessing ;D
« Last Edit: Fri, 01 January 2016, 16:18:55 by Camineet »

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Your changes are correct but you also need another "True" in both the buttonState[] and oState[] arrays so it has something to compare :)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1

#define HAT_X   2
#define HAT_Y   3

#define HAT2_X  4
#define HAT2_Y  5

//Buttons
#define HAT2_UP   9
#define HAT2_RIGHT  10
#define HAT2_DOWN   11
#define HAT2_LEFT   12




#define OVERVAL 0


int Xstick;
int Ystick;

int Xhat;
int Yhat;
int Xhat2;
int Yhat2;
const int center = 512;
const int hatThreshold = 128;

int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7, 8};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
  for (int i = 0 ; i < 9 ; i++)
  {
    pinMode(myPins[i], INPUT_PULLUP);
  }

  //Serial.begin(9600);
  //Serial.println("Joystick ready");
  Joystick.useManualSend(true);
}

void loop()
{
  // X axis computations
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
  Xstick = constrain(Xstick, 0, 1023);
  Joystick.X(Xstick);

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
  Ystick = constrain(Ystick, 0, 1023);
  Joystick.Y(Ystick);

  for (int i = 0 ; i < 8 ; i++)
  {
    buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
    if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
    {
      Joystick.button(i + 1, !buttonState[i]);
      oState[i] = buttonState[i];   // save state to compare next time
    }
  }

  //HAT
  Xhat = analogRead(HAT_X);
  Yhat = analogRead(HAT_Y);
 
  if(Xhat <= center + hatThreshold &&
  Xhat >= center - hatThreshold &&
  Yhat <= center + hatThreshold &&
  Yhat >= center - hatThreshold)
  Joystick.hat(-1);
  else
  {
    if(Yhat >= center + hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(45);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(315);
      else
        Joystick.hat(0);
    }
    else if(Yhat <= center - hatThreshold){
      if(Xhat >= center + hatThreshold)
        Joystick.hat(135);
      else if(Xhat <= center - hatThreshold)
        Joystick.hat(225);
      else
        Joystick.hat(180);
    }
    else if(Xhat <= center - hatThreshold)
      Joystick.hat(270);
    else
      Joystick.hat(90);
  }
 
  //HAT2
  Xhat2 = analogRead(HAT2_X);
  Yhat2 = analogRead(HAT2_Y);
 
  if(Xhat2 <= center + hatThreshold &&
  Xhat2 >= center - hatThreshold &&
  Yhat2 <= center + hatThreshold &&
  Yhat2 >= center - hatThreshold)
  hatWithButtons(-1);
  else
  {
    if(Yhat2 >= center + hatThreshold){
      if(Xhat2 >= center + hatThreshold)
        hatWithButtons(45);
      else if(Xhat2 <= center - hatThreshold)
        hatWithButtons(315);
      else
        hatWithButtons(0);
    }
    else if(Yhat2 <= center - hatThreshold){
      if(Xhat2 >= center + hatThreshold)
        hatWithButtons(135);
      else if(Xhat2 <= center - hatThreshold)
        hatWithButtons(225);
      else
        hatWithButtons(180);
    }
    else if(Xhat2 <= center - hatThreshold)
      hatWithButtons(270);
    else
      hatWithButtons(90);
  }


  // Update joystick state
  Joystick.send_now();
}

void hatWithButtons(int val){
  switch(val){
    case -1:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 0:
      Joystick.button(HAT2_UP, 1);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 45:
      Joystick.button(HAT2_UP, 1);
      Joystick.button(HAT2_RIGHT, 1);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 90:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 1);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 135:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 1);
      Joystick.button(HAT2_DOWN, 1);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 180:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 1);
      Joystick.button(HAT2_LEFT, 0);
      break;
    case 225:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 1);
      Joystick.button(HAT2_LEFT, 1);
      break;
    case 270:
      Joystick.button(HAT2_UP, 0);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 1);
      break;
    case 315:
      Joystick.button(HAT2_UP, 1);
      Joystick.button(HAT2_RIGHT, 0);
      Joystick.button(HAT2_DOWN, 0);
      Joystick.button(HAT2_LEFT, 1);
      break;
  }
}

Added the extra true to both parts but had no luck getting a response from the button.

I think it might have something to do with the fact that button nine is possibly already assigned to one of the analog to digital pieces of code.  I'm not sure how to resolve that, but I might try deleting some pieces of the code and trying to get it to compile which I can usually do with some trial and error.  Maybe that way, there won't be two commands in the code speaking to button nine.

Anyway, this endeavor is just a temporary measure to try and get flash into game while I wait for W11cE's additional 2 PS Vita mods to arrive.  Still though, I'm growing in skills pretty quickly in game, and I'm finding reluctance to play more without flash :-X

I've got something to list on eBay this morning, and then all try to play some more with the code ;D

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
If pin 8 is also an analog then you're right - it won't work. If that is the case change the 8 in mypins[] to a pin that's not an analog, or comment out the analog code for it which isn't in use
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
If pin 8 is also an analog then you're right - it won't work. If that is the case change the 8 in mypins[] to a pin that's not an analog, or comment out the analog code for it which isn't in use

Still no luck with the following reduced code

Code: [Select]
//PINS
#define STICK_X 0
#define STICK_Y 1


#define OVERVAL 0


int Xstick;
int Ystick;




int Temp;
int myPins[]          = {0, 1, 2, 3, 4, 5, 6, 7, 8};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[]      = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup()
{
  for (int i = 0 ; i < 9 ; i++)
  {
    pinMode(myPins[i], INPUT_PULLUP);
  }

  //Serial.begin(9600);
  //Serial.println("Joystick ready");
  Joystick.useManualSend(true);
}

void loop()
{
  // X axis computations
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
  Xstick = constrain(Xstick, 0, 1023);
  Joystick.X(Xstick);

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
  Ystick = constrain(Ystick, 0, 1023);
  Joystick.Y(Ystick);

  for (int i = 0 ; i < 8 ; i++)
  {
    buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
    if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
    {
      Joystick.button(i + 1, !buttonState[i]);
      oState[i] = buttonState[i];   // save state to compare next time
    }
  }

 
 
 

  // Update joystick state
  Joystick.send_now();
}


Everything else works as it did before.  The analog stick works along with all eight buttons.  But no 9th button.

I guess the next place to look would be either pin eight on the teensy, the cherry switch in question, or the wire job connecting the two.

Such troubleshooting activities will require more actual work as opposed to just some easy code changes and forum posts.  So unless I get really motivated about this temporary matter, I can hopefully just be patient and wait for the mods :)


Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
If you touch a wire between pin 8 and ground and that presses a button the problem is your switch/wiring, if it doesn't it's the code.  The code still looks good and there's nothing special about pin 8, so hopefully it just works.

If flash is so important why not put it on one of the other switches that work while you wait?
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
If you touch a wire between pin 8 and ground and that presses a button the problem is your switch/wiring, if it doesn't it's the code.  The code still looks good and there's nothing special about pin 8, so hopefully it just works.

If flash is so important why not put it on one of the other switches that work while you wait?

Oh yeah, that troubleshooting method works well to determine the problem is with the code.  All the other pins work when using wire to connect them to ground, but not pin 8 :(

Oh well, I guess I'll just have to live without flash for now.

Flash is one of those things that you really need direct access to without having to go through an alt key map.

Unfortunately, I've already filled up all the other buttons with commands that you have to have direct access to just to be able to play the most basic version of the game.  For example, return camera view to champion.  Without that, you can't really even play the game.  I supooooooose I could swap out the shop open button for flash, but ....  well i don't know :'(

Anyway, hopefully the new mods arrive sometime in the near future  ^-^

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
It's a 2 minute job to switch the 8 to a 9 and poke it with a wire, you know you want to :thumb:
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
It's a 2 minute job to switch the 8 to a 9 and poke it with a wire, you know you want to :thumb:

lol, Yeah I was like awe hell yeah I can just...


But no luck, tried changing the 8 to 9 and the 9 to a 10, even tried adding more true's.

No luck, only pins zero through seven work :'(

Offline W11cE

  • Posts: 23
This:
Code: [Select]
  for (int i = 0 ; i < 8 ; i++)
  {
    buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
    if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
    {
      Joystick.button(i + 1, !buttonState[i]);
      oState[i] = buttonState[i];   // save state to compare next time
    }
  }
should be like this:
Code: [Select]
  for (int i = 0 ; i < 9 ; i++)
  {
    buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
    if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
    {
      Joystick.button(i + 1, !buttonState[i]);
      oState[i] = buttonState[i];   // save state to compare next time
    }
  }

"i" goes from 0 to 7, which is why the state of the 9th button is not updated.

Offline Camineet

  • Thread Starter
  • Posts: 287
This:

yay, i can flash now :p thanks W11cE :D

Played seven games of league two nights ago.  And last night got started playing with the ability to flash and managed to save myself from death with it in a clutch moment :cool:

I really need to do some refinement work with the current build.  I have done nothing with it after getting it together because I've been too busy enjoying coming out of retirement :))

All the keys are still facing wonky tilt angles, and I need to do the usual job of correcting that.

I also need to add the aforementioned feet to the device so that it sits on my belly properly.

I think what's going on in my mind right now is that I'm just waiting for the new mods to arrive because I know that their implementation is going to require another partial tear down.  So, I don't really want to do a whole lot of refinement work until I got the final version functioning :rolleyes:

Anyway, I think it's time to finish up my work and play a game or two ;)

Offline Camineet

  • Thread Starter
  • Posts: 287
Hi all,

update.  I haven't done much work on the controller.  Actually, I have done zero actual work on the controller.  One thing I have done is some design work in which I decided to connect the bottom together with an arm.

I was previously reluctant to connect the bottom together because it means more work and more materials.  More materials means the device becomes just a little less sexy (i think it can actually be a very cool looking device once refined).

Ultimately however, I need to make some refinements to the device that will be assisted by connecting the bottom together.  Also, and perhaps more importantly, I want to reduce the risk of dropping and breaking the device.  With only the top as the connective tissue , so to speak, the design is too risky from a structural integrity standpoint.  If I dropped it or maybe squashed the device in some kind of mishap, I could hear a crunch and find that I've got a couple hours of repair work to do.  This kind of event could be pretty problematic if I'm traveling and don't have my workshop available, or if I have an important match coming up on the team I used to play and will hopefully play again.

So, I have sourced a chopstick that I think will make a good connecting arm and plan to pick up some Loctite gel superglue in the coming week to implement the connecting arm.

As for the reason why I haven't really done any actual work on the controller, it's because I've been using the darn thing daily to play league like a madman.  Last week on Thursday I stayed up playing until 5 AM  :eek:  Couldn't be happier ^-^  The controller just works so darned well.  It really does outperform the orbeaver in terms of key pressability.  I mean, think about it and picture a clarinet or saxophone.  Fingers can press very nicely and comfortably in a curled position rather than laid flat out as is required to press in a standard typing positioning.

I'm experiencing the difference between the orbweaver and my controller every day because I still use the orbWeaver for a ton of PC shortcut hot keys (that's what became of the device a few weeks after i had to retire from using it in league).  Like, all my movie playing, music playing, shortcut to the desktop… the list goes on and on.  I've got nearly every key on the orbweaver along with an alt key map in use for daily computing.

When I hit the keys on the orbweaver, which i still love and recommend, I sometimes think to myself, "my God that took so much force compared to pulling keys on my controller".

And as far as the outside keys go, I am in disbelief that this is not a thing.

Hitting the outside keys is natural and darned near effortless.  I don't think I'm some kind of ergonomics genius or natural talent.  But for whatever reason, this is the only device I've seen with outside keys like this(i've scoured the Internet).  And I'm certain that I'm not crazy or misperceiving how well the outside keys work.  I'm not an expert on any of this stuff, but I am into health, fitness, and have even studied gerontology a little bit in part of one of my degrees.  And together with over three decades of gaming experience, I'm certain that the natural and near effortless pressing of the outside keys is not my imagination.  I'm using the outside keys in-game for important and time sensitive commands, and they really work well.

Anyway, as mentioned in my prior post, with you guys' recent help with adding a button to the code, I have been able to flash which allows me to play almost all aspects of the game.  The only thing I'm not able to do now is smite which is required in order to play one of the five roles known as jungler.  Other than that, I can play the actual game in all of its important functionality in the other four roles of top, mid, adc, and support.  Although I can't dance,  taunt, or any of that silly stuff, those activities are not included in commands that are necessary in order to play the complete competitive version of the game.

Late last week, I received the wonderful news from W11cE that he has completed the two additional PS Vita mods and planned to ship them later that week.  Perhaps I will have them within a week or two.

Once I have implemented the additional PS Vita sticks, the controller will have what I expect to be zero compromises.  At the moment, I have my items 1 through 4 on an alt key map for the single existing stick, which is a little wonky (that's how i ward and use health potions).  Two additional sticks will resolve this and give me direct control of every aspect of the game along with what I believe will be superior usability to anything else available or thus far created for league or any other game I might get into such as overwatch or paragon.

Once again, I have to express my gratitude to everyone on this forum who continue to help me create this thing.  I'm really grateful for the support and fun times :-*




Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
I've missed your updates but happy to hear there's a good reason for it!

Talk to you soon when it's all wired up :)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
I've missed your updates but happy to hear there's a good reason for it!

Talk to you soon when it's all wired up :)
:thumb:

Offline Camineet

  • Thread Starter
  • Posts: 287
spent a lot of time this week on a major revision that turned out to be a giant fail >:D

I had to do probably the biggest tear down ever :eek:
124668-0
It was for the purpose of adding feet or something like table legs in order to bring the outside leg of keys further up and behind my fingers to make for even more natural and effortless pressing of them
124672-1
124670-2
Unfortunately, the new build with the table legs results in one of the old problems we surmised about before.  Stability is badly disrupted.  The device jumps up a tiny bit with every pressing of an outside key, which is intolerable :-[

124678-3
[ Specified attachment is not available ]
Now, just to get back to my prior build, I have towork on the device for a good three or four hours over the course of the next few days or so.  This sucks because Monday is here which means I won't really be able to get back into working order until probably middle to late week.

The device worked very well before because of the drag that was created by its entire surface area resting on either my belly or thigh.  Pressing the outside keys resulted in essentially zero movement of the device.  However, the outside keys were not as far around the back of my fingers as I preferred and their positioning resulted in me having to do a sort of tiny foreword push movement with my hand along with a small finger extension to actuate each outside key (it was sort of a slight push and lift kind of movement). 

This extra foreword movement wasn't a big problem (when i finally make a proper video, you'll be able to see that it was actually a non-issue), but I was hoping to improve functionality by eliminating it entirely so that only small finger extensions would be required to actuate the outside keys.  Unfortunately, it appears that it will be necessary to employ the slight forward push movement of the hand along with finger extension to use the outside keys.  The table legs have already come off.  the device jiggling and jostling was a usability killer.

oh well, i'll just have to write off the 4 or 5 hours i spent on this failed attempt on improvement ;D
« Last Edit: Wed, 20 January 2016, 20:57:41 by Camineet »

Offline Camineet

  • Thread Starter
  • Posts: 287
Hey guys, check out this awesome treasure I received in the mail today :-X
125821-0

W11cE has bestowed upon us 4 ps vita mods :)

and they're so small and nice :cool:
i will put to use 2 of them as planned. 

the extra 2 are a surprise gift, and i will quite possibly make a simple stick for use in my other hand to play some fps such as Paragon with, console style :cool:

question, which one of these pinouts do i connect the power?
125823-1

the product page says they're all for power?  maybe any of the 3 can be used?
https://oshpark.com/shared_projects/2p7rQYx8

my god, i can envision warding and popping off items such as health pots... summoner spells flash and smite with just the lightest flick of my thumb on vita sticks 2 and 3.  it will be so grand  ^-^

oy, gotta get back to grinding and shaping.  been doing that recently just trying to get the device back into fighting shape after recent design fails...

now that i've got these parts... better get a nap and gear up for some work  ;D

Offline hoosieree

  • Posts: 31
Late advice, but instead of this:

Code: [Select]
(Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
(Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;

You might prefer the readability of this:

Code: [Select]
buttonState[12] = Temp < -30;
buttonState[13] = Temp > 30;

Offline W11cE

  • Posts: 23
Connect those 3 to power. I guess originally those are separated only to get filtered +reference for analog axes. I doubt it's necessary here.

And credits for the idea and design goes to "hanya", I just ordered and soldered those.
To be honest, I never though about ordering my own pcbs, but after those I have already ordered many of my own designs.