geekhack

geekhack Projects => Making Stuff Together! => Topic started by: Camineet on Thu, 13 August 2015, 19:11:23

Title: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 13 August 2015, 19:11:23
edit: adding 3K's awesome sketch of the project so LoL friends can easily see what I'm working on ....
[attachimg=1]
Hi Adriano,

Thanks so much for offering to help me with this project. I've set up this post here so that you can read about my plans for this project. Hopefully this build thread will also help other aging gamers who are trying to avoid retirement or who are trying to come out of retirement from gaming.

My plan for coming out of retirement from league of legends is to use a pen tablet for pointing and clicking along with a one-handed grip style controller similar to the grip of a pistol but without the barrel.

The grip will have Eight buttons on the grip, a PS Vita analog stick on top, and three buttons surrounding the analog stick accessible to my thumb.

As you have mentioned having done in your project, I plan to use a Leonardo board along with cherry mx red switches for the buttons.

To begin with I need some help understanding which items in addition to the Leonardo board that I need in order to connect the cherry switches and analog stick to the board.

Thus far it seems that the items I need to purchase include:

The Leonardo board itself

A breadboard

Some wire

Soldering iron and solder

Something called pulldown resistors

The cherry switches

The PS Vita analog stick

A project box to put the board and other electronics into

Some wood and a dremel woodworking tool that I will use to fashion the grip first version which may possibly be done with a 3-D printer at a later time for a second version

Some of these items are a problem because I don't know which specific items to purchase. They include the wire, the breadboard, and the pulldown resistors.

I just don't know where to order these items from or what sizes I should get.

Hopefully if you can help me understand which specific items I need to order, I can at least get the parts needed for this project.

After that, I can start to try to understand how to use Arduino programming software in order to write this thing called the sketch along with learning how to wire all of the buttons and the analog stick.

Look forward to hearing from you when you return from holiday.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: AdryD on Thu, 13 August 2015, 23:19:51
Hi Marc :)

First of all, It's a pleasure to help you, when I did my project I didn't found help online so i had to do it by my own and I know that is frustrating sometimes ;)

I will quickly answer your question and then you can reply if you don't understand something...

To make what you are speaking about you need:

Arduino Leonardo (as you said)

A breadboard 800 dots or smaller (with a bigger is easier...) OR ---> You could buy a protoshield for arduino and solder everything (http://www.amazon.com/Arduino-Proto-Shield-R3-Assembled/dp/B007QXTRNA (http://www.amazon.com/Arduino-Proto-Shield-R3-Assembled/dp/B007QXTRNA)) because breadboard is cool for prototypation but isn't for closed project, wires aren't really soldered and it requires a lot of space...
With the protoshield you can solder everything and have a compact case, cherry MX has 2 pins, you just have to connect 1 of the pins to GND of arduino (you should wire all the gnd together, is easier) and the other pin to a digital (or analog used as digital) input of arduino, to do that you can use wires or solder them at arduino...
You are speaking about Pulldown resistor, usually if you write something like that in arduino

Code: [Select]
void setup(){
  pinMode(2,INPUT);
}
void loop () {
}


And you want to connect a button (Cherry works like other buttons) at pin 2 you need to pull a resistor between the GND and the button, Pulldown resistor is an arduino fuction that can help you with this...

You just have to write this way

Code: [Select]
void setup(){
  pinMode(2,INPUT_PULLUP);
}
void loop () {
}


And TADA! you can simply connect the button to GND and arduino pin without resistors (arduino apply an internal resistor ;D)

To mount Cherry MX you need a plate of 1.5 mm that is a very tiny plate and you need to make 14x14 mm holes (14x14 are the holes but every Cherry with Key fill a 18x18 hole), don't know if you can do it with wood, best way is with 3D printing...

IF you send me some pics of the components you got I will write you a fritzing sketch to understand how to connect and I could help you a little with code...

Going to bedroom (is 6.20 AM there haha)

Best Wishes, Adriano!

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 14 August 2015, 19:00:55
Adriano,

Thanks so much for getting me started here. You have no idea how crazy I am about league of legends. Me and fiancé can't get enough. Grateful for this help. Will have to repay you with kiteboarding lessons or something.

Can you post some stuff about your controller? What games do you use it for?

I have just now finished work and gotten started shopping for parts.

For wire, I found two options:

Wire 1
https://www.sparkfun.com/products/11367
wire 2
https://www.sparkfun.com/products/11026

which one of these do you think I need?

For breadboard, I found these two possibilities:

breadboard 1
https://www.sparkfun.com/products/12002

breadboard 2
https://www.sparkfun.com/products/12615


Which one of these boards do you think I need?

I will definitely get that proto-shield for final assembly. That will be very cool :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: AdryD on Sat, 15 August 2015, 11:31:25
First, at this link you can look for mine project... http://www.instructables.com/id/Arduino-Mechanical-Keypad/ (http://www.instructables.com/id/Arduino-Mechanical-Keypad/)

About what to buy the second link of the wires and the second link of breadboard are okays but on sparkfun price is very high... if you don't have any problems with money do as you want ;) anyway i usually buy things on Banggood.com, prices are really low! You have to wait a bit for deliver but that's worth isn't it?

Oh i play lol too, whats your IGN ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 15 August 2015, 12:39:57
Dawg, you play LOL too? That’s great, my IGN is Camineet.
You made a DIY Tartarus. It looks great and has those nice cherry switches instead of the rubber domed ones on the Tartarus.
Since you gave the green light on the wires and breadboard, I will go ahead and order them even though they are expensive because I don’t want to delay.

I actually just wrote a really long post here about ergonomics and the design of my controller, but I accidentally hit the back button and a three-page post disappeared. Now I’m just writing this in Word and have run out of time today. Very annoying, I wrote many things about hand architecture and game controller history going back 35 years (I even wrote many things about the razor Orbweaver I have been using for the past four or five months before that device started causing problems for me). So, now I’m just posting this much shorter update and getting ready for food shopping.

I’ll let you know when I received the parts.

By the way it looks like you’re on your way to becoming an international citizen by learning good English. I have spent some years overseas in Asia, and me and fiancé hope to travel to Europe sometime in late 2016 or 2017 for work. It would be great to say hi.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 15 August 2015, 23:17:03
Okay just found something I can't figure out on my own. I found two kinds of cherry switches. One is called plate mount, and the other is called PCB mount.

Which one do you think I should get?


http://www.wasdkeyboards.com/index.php/products/keyboard-parts/cherry-mx-red-keyswitch-mx1a-l1nw-linear.html


http://www.wasdkeyboards.com/index.php/products/keyboard-parts/cherry-mx-red-keyswitch-mx1a-l1nn-linear.html
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Zustiur on Sun, 16 August 2015, 02:00:28
I had the same question building my first custom board. If you have a PCB, definitely go with PCB mount switches. If you don't have a PCB, you can really choose either and it won't make a difference. PCB mounted switches just have extra nubs for creating a firm connection with the PCB.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: 3K on Sun, 16 August 2015, 03:04:37
I already read your guys thread yesterday and it sounds like you got an interesting project going on here!
Are there already sketches of the build to give this project a face?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: AdryD on Sun, 16 August 2015, 07:22:05
I had the same question building my first custom board. If you have a PCB, definitely go with PCB mount switches. If you don't have a PCB, you can really choose either and it won't make a difference. PCB mounted switches just have extra nubs for creating a firm connection with the PCB.

Thank you mate, Camineet contacted me on a yt video 'cause we were doing similar projects :D
I completed mine, he need a little of help so i'm trying to help him :)

I had the same question building my first custom board. If you have a PCB, definitely go with PCB mount switches. If you don't have a PCB, you can really choose either and it won't make a difference. PCB mounted switches just have extra nubs for creating a firm connection with the PCB.

Okay just found something I can't figure out on my own. I found two kinds of cherry switches. One is called plate mount, and the other is called PCB mount.

Which one do you think I should get?


http://www.wasdkeyboards.com/index.php/products/keyboard-parts/cherry-mx-red-keyswitch-mx1a-l1nw-linear.html


http://www.wasdkeyboards.com/index.php/products/keyboard-parts/cherry-mx-red-keyswitch-mx1a-l1nn-linear.html

3K is right, i bought pcb mount but i didn't use the 2 extra mount :p the important is that you build a right plate to mount the cherry then everything is okay ;)






Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 16 August 2015, 11:01:56
Hey guys,

Thanks for letting me know about the switches. I will go ahead with the PCB because it sounds like it offers more flexibility.

Okay, so obviously I am a great artistic talent. JK
http://imgsnap.com/image/g15

I don’t know Autodesk yet, so I just banged out this ugly sketch in MS paint. This is my design so far. I have put it together in my mind prior to sleep over the course of the past month or so.

An interesting point, the outer keys 5,6 I have read ,7, and eight will need to be cracked open and modded for lower than stock actuation force. I have read that this is theoretically possible. It will be necessary to have very low actuation force, such as 20 g, so that when extending a finger to activate an outer key, the user does not inadvertently depress an inner key because of the equal and opposite force.

As far as the hand rest goes, I’m not sure it’s needed. But it may help with stability for when the user needs to extend fingers to activate the outer keys. There may be additional necessary structural points for this functionality. For example there may need to be some kind of wrist strap or something to act as a mechanism for opposing force when extending fingers to hit the outer keys.

I’m thinking that I’m actually going to have to make the first prototype out of clay and popsicle sticks or something just to test the hand mechanics of this thing.

Why the pistol grip design instead of just something like the razor Orbweaver? That would take three pages of writing to explain. In summary, extensive history and understanding of my own tendinitis injuries, a pretty good understanding of the body through the practice of yoga and other fitness activities with little formal study in medicine, 35 years of gaming experience including almost 3 years of league of legends...  The list goes on
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: 3K on Sun, 16 August 2015, 11:43:23
After thinking about your design and trying out hand positions I drew something up.

More
(http://abload.de/img/pistul61ugh.png)


I noticed that the hands starting position, when typing on an usual '2D' keyboard, is mostly that one that seems most comfortable to the user. Same thing applies to firearms like pistols - the grip is designed to feel comfortable, optimized for pulling the trigger. This is the point where you could change your design.
While being optimized for pulling the trigger, a pistol is not designed for pushing a trigger. This does not mean it is not possible to push a trigger/ button - with the current design one movement would just be more tiring for the hand, than the other.

That's why I changed the needed starting angle of the finger in this sketch. If you let your hand rest on the table with your muscles relaxed, the fingers will most likely take the shown position - this should be the starting position from which the fingers will travel to actuate the keys in the opposing rows.

Also I found it hard to include keys 8-10 in the sketch, so I left em out.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 16 August 2015, 12:11:04
Bro, you’ve got it. This is exactly what I’m trying to build :thumb: You seem to have come to the same conclusion as me about the hand’s neutral/at-rest position - the position in which the hand is most comfortable and best able to exert force on keys with the least amount of trauma unto the fingers.

Bravo on these sketches. Wish I could draw like that.

I'll be in touch with you guys when the parts start to arrive. I placed my order for the breadboard, wires, and cherry switches. And I'll place my order for the Leonardo board in the next day or two :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 16 August 2015, 13:20:55
See the distance between the thumb and the index finger? I intend to make that distance as short as possible. That's why I'm interested in the PSP Vita analog stick. I need to go to the electronic shop nearby and test it first.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 17 August 2015, 11:50:50
reposting your sketch so it shows immediately without being hidden behind that 'more' button
[attachimg=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 17 August 2015, 23:13:44
Just checked Amazon order of Leonardo board. The board shipped and I noticed a strange estimated delivery date of nearly one month away. Turns out the Amazon listing for the Leonardo board is for a seller in the UK. I strongly prefer buying from Amazon, and this particular purchase save me two dollars compared with the sparkfun price.But this was a pretty lame mistake that is going to cause me to be twiddling my thumbs for the next three weeks or so. :mad:

I'll be in touch when the thing finally arrives.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: PikKirby on Fri, 21 August 2015, 00:51:28
Hmm.. wow this looks incredibly interesting. I've also daydreamed of a potential "2D" type esque.. almost exactly identical actually. Aside from the thumbstick.

From my testing though I noticed for the "upper" keys, it seemed more natural to have the keys position in the middle phalanx of the hand.

I drew up a quick dirty image.

(http://i.imgur.com/Stn5mNa.jpg)


One would assume that the keys would/should go where 1 is, parallel to the lower keys. But like I said, (possibly personal preference) I found the keys for the upper portion to be more comfortable when placed on the "little last nub" of your fingers like in the image (I have no idea what that part of the finger is specifically called.)

I found that if the upper keys were just parallel of the bottom ones, that the contact for them would be my fingernails; which are not very optimal... nor comfortable.

An option to make the upper keys, adjustable (Both X&Y?), may be a good idea.


Try testing it out, maybe it's just me.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 21 August 2015, 09:33:45
Bro, this is a great enhancement to the design, thanks for it.

Indeed, I also agree that the outer keys would be much more comfortably and effectively actuated with the last knuckle rather than with the very ends of the fingers which would essentially be using the fingernails as you said.

Small update: since my Leonardo board is nowhere to be seen and isn’t even scheduled to arrive for another couple of weeks at least, I’m going to start focusing on the form factor/housing aspect of the project.

So, in the next few weeks I hope to mold an initial design from sculptors Clay and try sticking the keys onto it to get a basic working design for ergonomics and physical functioning.

I have just now ordered a lump of clay from Amazon, and it should arrive middle of next week. Perhaps if I can get the basic design together, I can then move on to learning Autodesk a little bit. By the time I’m finished with that phase of the project, the Leonardo board should finally roll in from the UK sometime in the third week of next month.

I’ll be in touch with updates as I have them.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: 3K on Fri, 21 August 2015, 10:02:50
So, in the next few weeks I hope to mold an initial design from sculptors Clay and try sticking the keys onto it to get a basic working design for ergonomics and physical functioning.

I have just now ordered a lump of clay from Amazon, and it should arrive middle of next week. Perhaps if I can get the basic design together, [...]

You could just use cardboard!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 21 August 2015, 13:24:17
lol
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 23 August 2015, 16:21:31

just ordered the PS Vita parts to do this:


http://xim4.com/community/index.php?topic=31390.0
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: neverused on Sun, 23 August 2015, 16:24:24
I'm not sure if you have looked into it but the old psp analog nubs are cheap and we'll documented as well, especially in use with the arduino.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 23 August 2015, 16:38:32
Thanks for the feedback. From what I've read the PS Vita sticks are much nicer than PSP.

I Gamed on a PSP for a few years, and those sticks are definitely not gonna work as a long-term solution for camera control in League because they're stiff and just kind of crappy.

Since this project is for the purpose of trying to maximize the lifespan of the joints in my hands, I will go to some significant trouble to get the nicest components working on this controller.

It certainly would be nice if the PS Vita sticks didn't have these ass hat ribbon cables that require all this modding  to repurpose them.

I'm hoping i can get the PS Vita sticks to work because they're the shortest nicest sticks I'm aware of.  Short is important for keeping the thumb as close to the neutral/at-rest position as possible.  The usual analog sticks sold for arduino projects are pretty much the same as the Dual Shock 1,2, or 3 sticks, which appear to be something like 3 or 4 times taller than the PSP Vita sticks. 

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hanya on Mon, 24 August 2015, 02:15:55
I bought PS Vita Joystick from aliexpress at about $4.5 each. But they have not used on my project yet.
In my opinion, the connector for the joystick is AVX 046277006001883+ that can be by in mouser.

Reently Alps listed PSP joystick and PS Vita 2000 Joystick on Japanese site. PS Vita 2000 Joystick has different pinout from PS Vita 1000 Joystick.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 24 August 2015, 11:46:50
Easier pinouts like the ones on the PSP would definitely be nice :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 24 August 2015, 15:55:23
Hey Dawgs, I just received the Leonardo board ^-^

Didn't think it would arrive so soon because Amazon said it would take until the middle of next month :-[

Of course, I have no clue what to do with this thing and have to do some research on the most basic steps to get started connecting it to my PC and such.

I'll be in touch when I have made some progress :p
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 24 August 2015, 16:29:43
Good news, I was able to install the Leonardo on my PC and get the Blink example to work ;D

Now I will probably need some help on the next steps. I have here now the breadboard, the jumper cables, the cherry red switches, and what appears to be a working Leonardo board.

Can you guys tell me what I should do next when you have a chance?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 30 August 2015, 12:29:11
During the past week I have received the Clay and made the first basic design. It seems that Clay was a good way to go because I was able to make a shape that is perfectly molded to my hand.

There’s no point in sharing pictures because it just looks stupid and ugly-just a lump of clay with keys stuck to it.

I just now ordered some sculpting tools in order to be able to better work with the material. I have a plan to make a skeleton version with the Clay and some ice cream sticks to help support the structure and form. Once the skeleton form of the controller is finished, I plan to fire it in the oven to make a permanent hard base structure. Thereafter, since I don’t have any other options I can think of that are viable, I plan to just add more clay on top of the base structure, and stick the keys onto it by embedding them into the Clay and then layering some more clay over the wires that are soldered to the switches to cover them up. Maybe later I can do something more refined, but as far as I can tell, this approach is the fastest way to get me back into the game.


I am now still in need of help getting started on how to wire up the cherry switches to the breadboard and Leonardo. Would much appreciate some help with this area of work.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 31 August 2015, 06:32:08
Interesting project, not sure why you went with the Leonardo though - it's rather large for a handheld!

If you want another options for the body you might like to look into Polymorph (http://www.instructables.com/id/DIY-Material-Guide%3a-Polymorph-Plastic--a-thermal-/) ('Friendly Plastic' if you're in the US) - it's not the easiest stuff to use as it only sticks to itself when both parts are hot, but would be great once you got it right and you could adjust the spacing between the two parts once it's made.

Also worth a mention is Sugru (http://sugru.com/about/) - if you have lots of money to throw at the project you could build the whole body out of it, but I would use it to add a nice rubbery grip to your clay or plastic base.

Unfortunately you can't easily connect Cherry switches to a breadboard as the pins don't match but you can just connect where they would be using a wire to test your code, otherwise you'll need get some little switches made for breadboard.  You could solder wires to the real switches but you'd need to be careful as the legs are thin and aren't meant to bend so they snap quite easily.

Have you read some tutorials on switches and the like?  If not this one (http://www.ladyada.net/learn/arduino/lesson5.html) is as good as any.  The only difference when using an external breadboard is that you have "rails" down the side and/or end, usually you connect the red to your voltage (5v pin) and black to ground (GND pin) so they are easily available everywhere on the board.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 31 August 2015, 16:47:33
Thanks for joining this discussion with this helpful post. It’s much appreciated.

Interesting project, not sure why you went with the Leonardo though - it's rather large for a handheld

I am noob, so I don’t really know what’s available. I read that the Leonardo can easily be recognized by Windows as a game controller, so I went with that. As far as size goes, it’s not an issue because the setup will be handset => small project box => PC

The other materials you mentioned may in fact be very helpful for the final layering over the fired clay instead of just more clay, and I’d like to give it a try-I’ll probably go with Sugru.

The things you wrote about connecting cherry switches has made me realize that I need to buy some cheapie Arduino buttons-those little black ones that you see around. I can use those buttons for prototyping on the breadboard just so I can learn how to get this thing to work. And later I can change over to the cherry switches with soldering and such.

I’ll get to looking at the tutorial you linked in the coming days. Thanks again
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: neverused on Mon, 31 August 2015, 17:21:57
This may be helpful, I had the link stored away:

http://m.instructables.com/id/Add-a-little-two-analog-axis-thumb-joystick-to-you/
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 01 September 2015, 22:59:42
Oh yeah, I saw that indestructible before. There’s another one like it for adding an analog to the razor orbweaver.

Okay so I had a chance to look at this tutorial

http://www.ladyada.net/learn/arduino/lesson5.html

I will be working on this one for a while. I can see now that I probably should have done something like this first. But I really scoured the Internet in prior weeks and didn’t find anything helpful like this, so I resorted to spamming messages on forums. I think this tutorial is going to be helpful. I’ll go ahead and get set up to order the parts for it in the coming days..

I don’t really understand how a proto-Shield fits into the situation. What is the difference between a proto-Shield and the Arduino board itself, and how do they work together with a breadboard? I have just briefly looked over the tutorial. I’ll have another look and see if I can start to figure out this very basic stuff and order all the parts to get started.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 20 September 2015, 23:14:02
Small update.

Found a guy in Finland who has agreed to build this part for me for 50 bucks.

http://xim4.com/community/index.php?topic=31390.0



Next thing I have to do is buy all the parts and tools to be able to solder. As I'm sure you all know, something I have just discovered after receiving some more parts recently, I can't even begin playing around until I assemble a proto-Shield, which requires soldering.

That's all for now. I really should be playing around more with the clay. I've got my hands on one ice cream stick, along with a set of sculpting tools. But haven't had a chance to go back to work on the clay yet.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: blahlicus on Tue, 29 September 2015, 03:47:27
hmmm

this is a very interesting concept

do you have any thoughts on the manufacturing techniques needed to form an ergonomic hand "pistol grip"?

ergonomics are key so laser cutting would be out right away, CNC will probably not work due to the large amounts of curves, 3d printing would not be suitable for mass production and injection moulding would require a large seed fund

we need to think of a way to produce this thing without it being too cost prohibitive, perhaps resin cast moulding?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 29 September 2015, 17:00:32
Thanks for joining the conversation.

we need to think of a way to produce this thing without it being too cost prohibitive, perhaps resin cast moulding?

I like your thinking.  As I mentioned before, I’d like to do Zero Impact Gaming company at some point in the future and would need to get some of these questions answered along the way.  As far as cost prohibitive, man I’d pay something like 2 grand USD to get back into LoL TODAY if it were possible.  I imagine many of the 20 year olds who will spend the next decade banging their fingers into rubber domed keyboards to play LoL will be very happy to pony up a tidy sum for a viable way to continue playing this wonderful game into middle age when their fingers start to fail.

I’ve already prolly sunk about $150 in cash and a few hundred in opportunity cost just on the time I’ve spent designing in my head and fiddling around on forums, product pages, and with the actual parts that have arrived.

Anyway, manufacturing is fun stuff to think about and I'd like to hear more.

For now I need to learn how to use the dremmel –like tool I bought on Amazon to cut some skeleton parts to go inside the clay. 

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: blahlicus on Wed, 30 September 2015, 00:35:57
hey, just so you know, i am the owner of http://uniquekeyboard.com/store (http://uniquekeyboard.com/store) so i think i could give an accurate enough cost analysis on keyboard manufacturing

i mentioned injection moulding as cost prohibitive because getting an injection moulding manufacturing process started takes anything from ~50k to 120k, not ~5k, and that would need to be a large volume production, so you would need to be able to sell large volumes

i think you could get away with using a 3d printer for prototyping, then perhaps push the product to crowd funding?

for small volume sales, you are really looking at resin casting/some kind of casting since thats basically the only reliable method for creating durable curvy shaped objects without mass production
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 30 September 2015, 18:39:19
glad to have a friend in HK.  looks like a nice operation you've got going /w uniquekeyboards. 

yeah, I think just a 3D printer will be fine for the early adopters since they're usually willing to pay premium prices for innovative stuff.  i'm sure there won't be a mass market for this kind of product for at least 3 more years.

let's stay in touch and see what happens with this project.  i imagine i'll finish the controller and use it for a while with perhaps an occasional inquiry because of this thread.  and then in something like 2018 to 2020 I think we'll see the massive wave of now 25yr olds who will then be 30yrs old and have overuse injuries/RSIs ...they'll start to hit the boards looking for solutions as I did. 
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: neverused on Wed, 30 September 2015, 19:10:01


Small update.

Found a guy in Finland who has agreed to build this part for me for 50 bucks.

http://xim4.com/community/index.php?topic=31390.0



Wait. $50 for a connector with 4 wires? Lordy me
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 30 September 2015, 19:22:42
lol, i know it's pretty silly
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hanya on Wed, 30 September 2015, 22:26:52


Small update.

Found a guy in Finland who has agreed to build this part for me for 50 bucks.

http://xim4.com/community/index.php?topic=31390.0



Wait. $50 for a connector with 4 wires? Lordy me
Just like https://oshpark.com/shared_projects/2p7rQYx8 would be enough.
Connector:
http://www.mouser.com/ProductDetail/AVX/046277006001883+/?qs=%2fha2pyFadugU9ExvltPLtf03k1mhZoZgBfiT04U%252bjLiCwPsLFCj2Qw%3d%3d
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: blahlicus on Fri, 02 October 2015, 15:15:38
hmmm, i'll see if i could create a prototype no joystick version of this thing with the laser cutter and have my friend custom sculpt wooden handles for me just to test out the idea

i have all the materials i need to build this thing anyway so you know, might as well

im slightly worried about misclicks (popping zhonyas at the wrong time because my index finger flexed too much seemed like a mood breaker) and using the thumb for summoner spells (cant flash->ignite)

are you from hong kong too Camineet?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 03 October 2015, 09:39:58
Hey blahlicus, naw i’m from detroit :/
But i have been to HK once on a visa run while living in shanghai back in ’09 or so.  Was only there in HK for like an hour or so though.

Hope to return to china in late 2016 after a 5 year project back home is complete

It’s great if you can also work on the controller with a different approach of wood and laser cutter. The more eyes on this project, the better for all aging gamers out there.

Didn’t realize you were also a LoL player. It’s been months since i flash-> ignited.  My god what i’d give to do that right now. Don’t worry about misclicks. Once xpadder is paired with the leonardo board, many possibilities come about with alt key mappings.  For example, hold down a thumb button on top for alt key map...now index and middle finger go from Q W to Flash and 2nd summoners.  Perhaps flick your index outward for zhonas.

I know from experience.  I used to play with Xbox controller in left hand and Logitech M570 in right hand.  LoL is much better with a controller or an orbweaver or with what we are trying to build. ESPECIALLY because you get true camera control /w thumb.  Not that laborious thing of pulling your pointer away from the action to the edge of the screen and ‘bumping’ it outward.  Rather, in case you haven’t somehow played in this way, let me tell you, you get an elegant continual feathering of fine camera control – positioning the camera to a tactically optimal position at all times – an activity which is INDEPENDENT of all other commands.  Its wonderful although i have not managed to convince any of my LoL friends of this or anyone else in the community for that matter. 

Anyway, point was that /w xbox controller and xpadder, i had something like 21 buttons fluidly available via alt keymaps activated by bumper and trigger.  Same on orbweaver using the thumb buttons to bring up alt key maps.  Unfortunately, due to age and the intensity of LoL along with the non-optimal ergonomics of both of those devices... RSIs.

Spectated a game of LoL last night.  You’d think i’d start mising it less. Not so.  I miss it more and more :/

And it even seems like the game is getting better with the new champs and visual upgrades.  Man, the game is looking so good just 60 days later...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: 3K on Sat, 03 October 2015, 12:27:29
I know from experience.  I used to play with Xbox controller in left hand and Logitech M570 in right hand.  LoL is much better with a controller or an orbweaver or with what we are trying to build. ESPECIALLY because you get true camera control /w thumb.  Not that laborious thing of pulling your pointer away from the action to the edge of the screen and ‘bumping’ it outward.  Rather, in case you haven’t somehow played in this way, let me tell you, you get an elegant continual feathering of fine camera control – positioning the camera to a tactically optimal position at all times – an activity which is INDEPENDENT of all other commands.  Its wonderful although i have not managed to convince any of my LoL friends of this or anyone else in the community for that matter. 

So you basically controlled the cam with the left hand using a stick while at the same time aiming attacks with the mouse on the right? Does this work out of the box? I thought both inputs would be registered equally by the computer, making them overlap and not work this way?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 03 October 2015, 17:49:37
hanya,

Just like https://oshpark.com/shared_projects/2p7rQYx8 would be enough.
Connector:
http://www.mouser.com/ProductDetail/AVX/046277006001883+/?qs=%2fha2pyFadugU9ExvltPLtf03k1mhZoZgBfiT04U%252bjLiCwPsLFCj2Qw%3d%3d

these parts might be very helpful.  i hope to be able to understand them better.  maybe someone here with better understanding of electronics can assist.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 03 October 2015, 18:16:39


So you basically controlled the cam with the left hand using a stick while at the same time aiming attacks with the mouse on the right? Does this work out of the box? I thought both inputs would be registered equally by the computer, making them overlap and not work this way?

3K,

I think i know what you mean about the overlapping.  But in practice, it brings about something wonderful.  Yes, when using arrow keys or a joystick to move the map, the pointer comes along for the ride. It does not get left behind in its position, but rather remains in its relative position on screen.  You can therefore place the pointer onto anything by only using camera control if you really wanted to.  Try it.  And yes, it is out of the box /w camera unlocked as anyone other than a 1st time player would choose.

Why is this helpful?  Something outstanding happens with the combo of joystick and mouse, which is a combination very similar to WASD and mouse control in an FPS.  One movement is the macro or large imprecise movement control while the other movement allows for the finer control. 

With this combo and league, you end up using the camera control continuously, which also moves the mouse pointer in an imprecise but non-laborious way, while making quick, purposeful, precise pointing commands with the mouse. The result is that you move the mouse pointer vastly less often and with much less travel distance than the conventional way of using the mouse without assisting its movement with any complementary movement. Another way to state this would be that you not only have continuous independent direct camera control, you also get a significant pointer control assist that takes something like 70% of the labor out of moving the mouse pointer because pointer control is essentially done with two hands instead of one.

The difference is night and day.  How big of a difference?  imagine playing an FPS without any WASD controls for walking, and you only had a mouse to control your reticule and could never strafe    
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: blahlicus on Sun, 04 October 2015, 02:40:39
the laser cut + wood approach will only be used for prototyping since its basically impossible to mass produce those, i just have better accessibility to that compared to 3d printing

yeah i totally get what you mean with the camera controls, being able to use a joystick with it must be nice since your cursor never have to touch the screen edges and you will also probably get better situation awareness

i dont think i will enjoy playing league with alt+key combos though, you get delays with key combinations and its easy to get confused with key combos especially when you have to do it quickly (mid main over here heh), my main worry of the current design is the top keys, i just feel it might be too easy to accidentally hit the top keys, really need to get a prototype out and use it for a while to get a feel of it though

i think i have a good solution for summoner spells, see picture below

(http://i.imgur.com/WkvE3xZ.png)

i think its harder to mispress those keys than the keys on top
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 04 October 2015, 09:41:26
oh wow, this isn't just a good addition for summoner spells, it's a good design addition in general :thumb:

i never thought of having yet another dimension of finger travel to be used for another set of buttons. nice one ;D  this will just give much more options for keys without relying too much on alt keymaps.  item activations, laughs, taunts, dance, etc. will be more readily accessible.

when i get the clay version together, you'll see that it's basically impossible to hit the top keys by accident because they are actually higher than the vita analog stick.  you have to pick up your thumb a bit to lay it onto a top key and depress it.  otherwise, you just bump into the side of the keycap when moving your thumb side to side. 

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: blahlicus on Sun, 04 October 2015, 09:54:08
oh! i think we are having a misunderstanding, i meant top keys as in the keys that you hit by straightening your fingers, the "item" keys

i felt those would be easily mispressed
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 04 October 2015, 10:10:38
ah yes, indeed there is the possibility of that.  wish i could get my version together quicker to test these things.  amazon order /w cutting tool for next steps just shipped
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 04 October 2015, 10:22:01
I've been thinking about this and how close it is to being able to use two as a full keyboard, so why not add another switch per finger?

(http://i.imgur.com/KEYFBhC.png)

In place of the joystick I'm thinking three switches per thumb which still only takes the keycount to 38, but adding two imaginary 5th fingers (operated by the index fingers being raised toward the thumb) would make 46, which is more than a JD40...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 04 October 2015, 18:12:33
oh yeah this is great xD

i can't make anything other than the 2d version /w my planned clay efforts, but maybe you and the other guys working on different material approaches can do this kind of advanced functionality version :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 04 October 2015, 18:33:02
It's quite hard to get my head round how to actually make this, it's not even like you can make strips of switches for each position and stick them together as all the fingers are different sizes.  I think clay is a great choice as it doesn't harden anywhere near as quickly as the plastic and hot glue I'll be using, and you're very unlikely to burn yourself while I'd rate my chances 50/50 at best!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: 3K on Tue, 06 October 2015, 11:48:30


So you basically controlled the cam with the left hand using a stick while at the same time aiming attacks with the mouse on the right? Does this work out of the box? I thought both inputs would be registered equally by the computer, making them overlap and not work this way?

3K,

I think i know what you mean about the overlapping.  But in practice, it brings about something wonderful.  Yes, when using arrow keys or a joystick to move the map, the pointer comes along for the ride. It does not get left behind in its position, but rather remains in its relative position on screen.  You can therefore place the pointer onto anything by only using camera control if you really wanted to.  Try it.  And yes, it is out of the box /w camera unlocked as anyone other than a 1st time player would choose.

Why is this helpful?  Something outstanding happens with the combo of joystick and mouse, which is a combination very similar to WASD and mouse control in an FPS.  One movement is the macro or large imprecise movement control while the other movement allows for the finer control. 

With this combo and league, you end up using the camera control continuously, which also moves the mouse pointer in an imprecise but non-laborious way, while making quick, purposeful, precise pointing commands with the mouse. The result is that you move the mouse pointer vastly less often and with much less travel distance than the conventional way of using the mouse without assisting its movement with any complementary movement. Another way to state this would be that you not only have continuous independent direct camera control, you also get a significant pointer control assist that takes something like 70% of the labor out of moving the mouse pointer because pointer control is essentially done with two hands instead of one.

The difference is night and day.  How big of a difference?  imagine playing an FPS without any WASD controls for walking, and you only had a mouse to control your reticule and could never strafe

This sounds really good and I would love to test this out! Unfortunately I do not own any device with joystick that works on my computer right now. I'll look into connecting my wireless XBOX360 controller.

I guess this is a strong argument for not missing out on a joystick on the device this thread one day will publish!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 06 October 2015, 12:01:17
It's quite hard to get my head round how to actually make this, it's not even like you can make strips of switches for each position and stick them together as all the fingers are different sizes.  I think clay is a great choice as it doesn't harden anywhere near as quickly as the plastic and hot glue I'll be using, and you're very unlikely to burn yourself while I'd rate my chances 50/50 at best!

I don't want to discourage new friends here from trying different approaches in constructing the housing for this thing, but I will tell you this.

In working with the Clay to get the basic shape, I have found a great deal of required fiddling about in order to get the right angles and shapes. I think that by starting with something that is not in direct contact with the hand such as drawings on a computer or any other such indirect and non-immediately and non-continuously malleable material will be met with small to significant differences in the shapes and angles needed.

I'm not sure if that makes sense, but what I'm trying to say is that you really need to get the basic shape down by putting something into your hand that can be adjusted or tailored right then and there. Going back and forth between hand and work desk while constructing something that requires some number of minutes just to make a tiny adjustment, as opposed to just pushing, poking, or squeezing for a half second to make the adjustment, seems to me to be prohibitively time-consuming and difficult.

It would also suck to burn yourself with hot glue xD

At any rate, like I said, I don't want to discourage anyone from different approaches.  Just hoping to share my experience thus far ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 06 October 2015, 12:05:12


So you basically controlled the cam with the left hand using a stick while at the same time aiming attacks with the mouse on the right? Does this work out of the box? I thought both inputs would be registered equally by the computer, making them overlap and not work this way?

3K,

I think i know what you mean about the overlapping.  But in practice, it brings about something wonderful.  Yes, when using arrow keys or a joystick to move the map, the pointer comes along for the ride. It does not get left behind in its position, but rather remains in its relative position on screen.  You can therefore place the pointer onto anything by only using camera control if you really wanted to.  Try it.  And yes, it is out of the box /w camera unlocked as anyone other than a 1st time player would choose.

Why is this helpful?  Something outstanding happens with the combo of joystick and mouse, which is a combination very similar to WASD and mouse control in an FPS.  One movement is the macro or large imprecise movement control while the other movement allows for the finer control. 

With this combo and league, you end up using the camera control continuously, which also moves the mouse pointer in an imprecise but non-laborious way, while making quick, purposeful, precise pointing commands with the mouse. The result is that you move the mouse pointer vastly less often and with much less travel distance than the conventional way of using the mouse without assisting its movement with any complementary movement. Another way to state this would be that you not only have continuous independent direct camera control, you also get a significant pointer control assist that takes something like 70% of the labor out of moving the mouse pointer because pointer control is essentially done with two hands instead of one.

The difference is night and day.  How big of a difference?  imagine playing an FPS without any WASD controls for walking, and you only had a mouse to control your reticule and could never strafe

This sounds really good and I would love to test this out! Unfortunately I do not own any device with joystick that works on my computer right now. I'll look into connecting my wireless XBOX360 controller.

I guess this is a strong argument for not missing out on a joystick on the device this thread one day will publish!

You can actually try this right now very easily. Camera control in league is mapped to the arrow keys by default.

You can start a custom game, put your right hand on your mouse as usual, and then put your left hand on your arrow keys as if they were WASD.

Try going through the first five or 10 minutes of a bot game just laning like this, and I bet you'll be hooked :))

actually, if you're historically a console gamer, then you'll need to experience this /w a thumbstick one way or another, such as /w your 360 controller, to really see the magic.

but if you're historically a pc gamer /w pc fps experience using WASD, you should be able to see the magic immediately ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 06 October 2015, 13:24:54
It would also suck to burn yourself with hot glue xD

Yes, it does!  I made a numberpad using nothing but keycaps and hot glue and had to take a week gap in the middle due to burn blisters.  Not keen to get more of them :))

The polymorph I mentioned earlier is very bendable for about 30 seconds after sitting in hot water and adjustable for another 10 so not too bad.  My latest thinking is to make two knuckle-shaped thin sausages and lay them on a desk.  Then reheat the places where the switches will go and push them in to get them to grip and melt a couple of notches in the ends.  Next I'll somehow hold/prop it up with the switches in position and loop another piece round both ends to secure them, and finally heat where the "loops" meet the "sausages" to stick it together.  Hopefully I can keep the switches openable for spring/stem swaps...

After repeating this for the four(?) sections of switches will come the biggest problem of how to stick it all together, but I'll tackle that when I get there.  This may well be where the hot glue comes in which will be fine while making the left hand but I don't like my chances when it comes to doing it wrong handed :-X


If this is actually happening should the thread be moved to the making stuff together! section?  And where are your pics?!

edit: so, you're right.  No way this stuff is going to work.  I managed one strip of 4 switches but they're wonky and not spaced widely enough for anything but fingertip use, and they aren't staggered enough for that.  Two switches mounted in a loop works, but what use are 2 switches when you have 4 fingers?  Not much :(

More
(http://i.imgur.com/PXvdt1C.jpg)

(http://i.imgur.com/XoAyBac.jpg)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 06 October 2015, 20:42:49
lol, yeah i did stuff like that in my head for what must have been over a month.  couldn't ever figure out how to piece it all together without it all being once piece to begin with.

yeah maybe it's a better thread in the make stuff together forum.  might get even more participants :thumb:

my lame pictures from like 6 weeks back i figured i'd not post and save myself the embarassment :confused:

this is as far as i got before i couldn't add anymore without icecream sticks.  now i've got the thing torn down /w an icecream stick in place of the thumpad panel which i need to redo /w clay. 

amazon cutter tool arrived today, so i can try to make a corner piece of skeleton for attaching the outside row of 4 keys...module..

[attach=1]
[attach=2]

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 07 October 2015, 03:30:25
Looks way more usable than my efforts, good work!

Did you wire the switches up first?  I don't see any wires but it looks pretty solid so hard to add them later.  And definitely no switch top removal as they're really stuck in there...  If I did the wiring first my beloved hot glue would be a viable option :))

In other testing I tried an MX brown with the back of my pinky and it felt quite stiff, will have to look into a lubed linear or maybe a Geteron clear spring (35g) for that spot.

I nearly reported the thread to the mods so they could move it but decided I should leave it up to you to decide if you want to do that or start a new one :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 07 October 2015, 15:42:59
naw, you overestimate my electronics skills.  glad you like the mockup, but it's just a lump of clay in those pics.  i haven't gotten into any of the electronics yet really.

at the moment, the finnish guy has just agreed to do the vita stick mod this week and ship it out soon. 

and i still need to order soldering stuff in order to assemble the proto board just so i can do that really long tutorial for using buttons and turning on lights.  i really have to start from teh basics because i've never done any of this stuff.

yeah, those keys are stuck in there.  but they're easy to pull off.  i plan to use hot glue or one of those other permanent options once i get further along.  i know how it is with materials like your hot glue.. once you get used to working with something, you wanna continue making everything with it ;D

35g switches would indeed be better for the outside keys.  i couldn't find anything lower than 40g in my internetting.

yeah, go ahead and report to mods and we can maybe get some more participants in that other forum :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: user 18 on Wed, 07 October 2015, 20:05:48
Moved :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 09 October 2015, 18:44:31
Cutting this was every bit the giant pain in the balls I knew it would be.  Took like an hour, is pretty sloppy on one side.

Hopefully it will serve well enough to provide internal rigidity needed for me to be able to clay up the module for the outside row of keys :'(
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 10 October 2015, 16:21:25
Is that milled out of wood?  It really doesn't look a nice shape to make but you'll never see the roughness when it's covered in clay so all good :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 11 October 2015, 16:57:27
Naw, that's just some plastic I cut out of an old plastic housing from a Lucent PBX phone system that I found in my basement xD

I'm pretty shy on tools over here so milling and stuff is just foreign-language to me :/

But yeah, it will be fine when covered in clay. I've actually found that every arm of this thing will need a skeleton piece inside because the Clay has a tendency to crack and without something inside to maintain the structure it just falls apart.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 11 October 2015, 17:40:28
No fun tools here either :(

I saw something in someone's project where they were holding switches between the wire of a coathanger - that would make a nicely adjustable skeleton to mold around, if I can find one of a nice thickness.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 11 October 2015, 18:27:52
wow, wire hangers is a pretty good idea :)

i went on a rampage a few years ago after getting sick of cheap wire hangers and threw them all away yelling 'no wire hangers in this house' like that old movie mommie dearest  :confused:

have to see if i can scrounge one up and give it a try ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: zlittell on Thu, 15 October 2015, 09:11:24
You really need something to make the basic shape that fits in the hand well and then 3D scan it into the PC.  Then you could model in all the goods for the switch, thumbstick, and electronics.  Get it 3D printed.  Maybe even leave areas to fill with a rubber like material of some sort.

Also if you are looking to have this show up as a joystick instead of a keyboard I will put a shameless self plug in here.  www.zlittell.com
I list some of the cons of using USB hid as a joystick in the beginning of my post.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 19 October 2015, 00:27:13
yes please plugs give more awareness to the thing.

will be in touch with planned work of sugru for the torso of the spider if successful.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 25 October 2015, 10:49:14
small update of alien genitals 3rd mockup ^-^

As I mentioned before, I have found that all legs of the spider require a skeleton piece if I am to use this particular sculpting Clay called  Sculpey found on Amazon.

This particular Clay doesn't require water, so it's good to work with for mockups. But it remains floppy and actually breaks apart on its own when sitting for a while.

These pics include the newly created skeleton piece for the outside keys leg (a piece of plastic i cut from a lucent pbx phone system box), along with the primary handle leg skeleton piece that I fashioned from a staple remover and plan implement in the coming days/weeks.

What I have now also found is that the torso remains floppy, and so it will be necessary for all of the legs to be tied together with a rigid material. So, I ordered a pack of Sugru and will rebuild the entire unit leg by leg and see how that goes. 

The part from Finland arrived, and it looks like fine work.

I've also ordered a soldering kit so I can put together the proto-Shield that will allow me to do the tutorial which will give me some basic electronics skills.

That's all for the past two weeks or so. Yes, I do know that this thing looks quite wretched ;D And it may in fact look wretched when it's complete :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 25 October 2015, 14:14:15
Looking good, I can see how it's all going to fit together now.  If it's comfy and it works who cares how it looks :thumb:

If you're hoping to replace all that pinkish stuff with Sugru you're going to need a lot more than one pack though, unless there's a lot of solid stuff hiding in there.  Also don't forget you need to get some wires to the switches!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 25 October 2015, 15:03:41
Hi. Im the guy from the XIM forums that made the adapter.

Looking interesting. Many same ideas that me and some friends had on our keypad modding era.
How well can you hold it in your hand? Can you get a good grip, because with squeezing your fingers you press the keys instead of trying to keep it tighter in your hand.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 26 October 2015, 21:49:20
seems to be no problem sitting in hand and not falling out.  that's the reason for the alien's full set of genitals, to act as a hand rest of sorts.  the weighting seems to be good too as far as hitting outside keys goes.  but only until i get further will i be able to confirm functionality.

and from the "let's still only use our thumbs to play games" camp we have...

https://www.kickstarter.com/projects/1384390939/grifta-morphing-gamepad

at least the king's assembly doesn't waste all those input possibilities...

https://www.kickstarter.com/projects/70308014/kings-assembly-a-computer-mouse-full-of-awesome/description

not ergonomic enough for my hands to avoid RSI in the long-term, but still a fine piece of work i'd say.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 26 October 2015, 22:08:26
Looking good, I can see how it's all going to fit together now.  If it's comfy and it works who cares how it looks :thumb:

If you're hoping to replace all that pinkish stuff with Sugru you're going to need a lot more than one pack though, unless there's a lot of solid stuff hiding in there.  Also don't forget you need to get some wires to the switches!

it will be only as much sugru as required to get a rigid structure.  then i will build it out with this cheap clay which is good for embedding wires and stuff. and this clay doesn't really get dirty as far as i can tell.  stuff doesn't easily stick to it so i think it can be dusted pretty nicely :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 01 November 2015, 16:22:25
extremely pleased with sugru.  used only 2 of the 8 packs that came.  so, just about 5 dollars worth.  this product is very easy to shape and work with and i can see why its got so much buzz.

this is the first piece of the reconstruction.  i'll try to tackle another leg next week.

hopefully have set the angles right for neutral hand position with zero required extension at rest.

[attach=1]
[attach=2]
[attach=3]
[attach=4]
[attach=5]
[attach=6]
[attach=7]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 01 November 2015, 16:34:39
This is coming together nicely, glad to hear the sugru is working out :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 01 November 2015, 16:42:37
completed proto-shield assembly today.  first time soldering and was like, 'well here goes nothin' :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 01 November 2015, 16:46:49


This is coming together nicely, glad to hear the sugru is working out :)

yeah thanks for saying so.  it was a pretty good day in the shop except for the part when i put the power rails on and all the solder bled together.  spent a while on youtube learning how to desolder with wicking until i realized the power rails connection is supposed to run together ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 05 November 2015, 13:04:05
Getting started on the area that is going to be the biggest challenge for me :-X

I managed to get a light to turn on ;D but I think the rest of this part of the project is going to be pretty time-consuming for me.

at any rate, after watching the league of legends world finals these past few days, I'm resolved to start putting more time into this project so I don't die of league malnourishment. I think it's already been three months since I played.  back to the tutorials now :eek:
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 05 November 2015, 16:47:45
behold... blinking lights ;D
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Thu, 05 November 2015, 16:49:52
behold... blinking lights ;D
(Attachment Link)

Very nice, but aren't you supposed to be playing with switches? :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 05 November 2015, 19:24:01
no kidding :D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 05 November 2015, 20:06:06
Have run into my first fail and need help :rolleyes:

I can't get the Leonardo board to run the hello world sketch. Nothing is output to the serial monitor all.

I follow the instructions in this tutorial here:

http://www.ladyada.net/learn/arduino/lesson4.html

Resetting the board doesn't get it to output anything in the serial monitor.  Resetting just results in the L led blinking once followed by the RX led blinking twice.  The TX led doesn't light at all which I understand is the indication that data is sent to the PC to be output on the serial monitor.

I tried reloading the blinking lights sketch and that works fine. So I've confirmed that I can upload sketches and they work. But I can't seem to get the hello world sketch to work at all and don't have enough experience to guess what might be wrong.  I've reloaded blink and hello world back and forth about 4 times just to see if I could get hello world to work, but no luck.

Here's the sketch from the tutorial that I'm using:

/*
 * Hello World!
 *
 * This is the Hello World! for Arduino.
 * It shows how to send data to the computer
 */


void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
 
  Serial.println("Hello world!");  // prints hello with ending line break
}

void loop()                       // run over and over again
{
                                  // do nothing!
}

Here's a screenshot of the arduino application on my PC:

[attach=1]

help would be much appreciated :confused:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 05 November 2015, 20:29:47
*oh, and I tried removing the proto-shield just to see if it might have been somehow interfering /w the hello world sketch.  but still no luck getting the sketch to output anything.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: neverused on Thu, 05 November 2015, 20:52:10
Do you get an error when uploading? Did you open the serial monitor? (use ctrl +shift+m)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 05 November 2015, 22:25:51
thanks for reply ;D

no error when uploading i'm sure because i've seen them before and know what they look like.  there's some red stuff.  every so often the com port gets lost or something and i have to reset the board to get leonardo on com 5 to show up again.

but i don't get any error message when uploading hello world.

tried opening and closing serial monitor about 20 times.  before resetting board, and after.

here's a pic of the serial monitor.  baud rate matches sketch.  i'm stumped :'(

[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: neverused on Thu, 05 November 2015, 23:45:40
Hmmmmm I'm not sure what the issue is. However since your goal is physical hardware with individual outputs, you may look at these tutorials: https://www.arduino.cc/en/Tutorial/BuiltInExamples

They are built into the IDE, are well documented, and explain the code to you. If you have a single switch, you can start on the digital examples.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 06 November 2015, 11:19:14
I guess I'll try this tutorial to see if I can get a button to send data to the PC:

https://www.arduino.cc/en/Tutorial/BuiltInExamples

If that fails, I'm going to need to get a new board.

Troubleshooting has been done as follows:

I tried two other USB cables because sometimes those things can act funny.  No results.

I tried the whole set up on another PC. No results.

I think the board is faulty. If it can't even send hello world to the serial monitor, I doubt that it's going to send zeros and ones to the serial monitor as in the button tutorial above :'(

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 06 November 2015, 14:53:31
Have you tried asking it to send keyboard keypress (https://www.arduino.cc/en/Reference/MouseKeyboard) like you'll be doing in your controller?  Not sure if it uses a different connection method but it certainly doesn't output anything to the serial montior while typing, so I'd guess it's on a separate USB endpoint.  This keeps typing n once every 10 seconds so it's pretty useless, but good enough to test and slow enough to not interfere when you want to flash with something else useful :)

Code: [Select]
void setup() {
  Keyboard.begin();
}

void loop() {
  Keyboard.press('n');
  delay(100);
  Keyboard.releaseAll();
  delay(10000);
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 06 November 2015, 15:11:23
this works :thumb:  thanks as always for the help.  i had already gotten rma from UK seller nn.. have to upload a diff sketch to stop the 'n's :))

had already gotten rma from UK seller but figured shipping wouldn't be worth it.  then shopped for new board from local seller but won't need a new board it seems.

i guess i'm back on track now and will continue tinkering :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 11:12:55
trimmed proto-shield pics post to make page less obnoxious when loading  ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 11:34:17
I've been thinking about this and how close it is to being able to use two as a full keyboard, so why not add another switch per finger?

Show Image
(http://i.imgur.com/KEYFBhC.png)


In place of the joystick I'm thinking three switches per thumb which still only takes the keycount to 38, but adding two imaginary 5th fingers (operated by the index fingers being raised toward the thumb) would make 46, which is more than a JD40...

you and blahlicus are right, more is better.  league has a lot of commands, and making as many to be immediately available as possible without resorting to alt keymaps is helpful.

i've had some designs in my head for adding a fingertip row of keys as in blahlicus' drawing.  if that works out, it may be possible to add a 4th row of keys as in your drawing here. 

still, league has a ton of commands needed, and i working on this project with the goal of having alt keymaps available via xpadder.

alt keymaps are very helpful for lesser used commands such as leveling up abilities by using the same button as the ability but with a modifier key to access the alt keymap. 

another example, radial ping picker doesn't work in league for those of us using alternative pointer input devices such as my pen tablet.  this limitation creates the need for even more available keys than normal players need.  in such cases, one must bind a key for each of the 4 pings.  again, alt keymaps are very helpful for these kinds of things. 

items 1,2,3,4?  bound to the 4 'home' keys of league 'qwer' on yet another keymap.  very effective in my experience.  maybe even better than standard keyboard 'cause your fingers don't have to move at all from league home keys, you just press down with your thumb or something to get to alt keymap. 

but there are some things such as 'return camera to champion' button that needs to be immediately available.  same with a ton of other stuff like 'score = tab', 'shop', and of course summoner spells...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 11:58:02
ready for next steps i think....

i've had about enough of learning basics of what's going on with these devices by doing tutorials, recently having completed this one which has the pin report to the pc whether it's high or low.

[attach=1]

if possible, i want to move forward now with trying to get some things wired up and programmed for the actual application i'm working towards. 

just now, i've successfully tested this gamepad sketch on my Win 7 PC and it works :thumb:

http://www.instructables.com/id/Add-USB-Game-Controller-to-Arduino-LeonardoMicro/?ALLSTEPS

now i'm stuck because i can't find what to do next.  for my application, i need the leonardo to be acting as a game controller, not as a keyboard and/or mouse(?).  that's because i need the leonardo to be recognized in xpadder, which it is after implementing step 1 from the instructable above.

xpadder is particularly important for this project because of the need for alt keymaps.  As i’ve mentioned before, i’ve used alt keymaps in league before to succesfully get over 20 commands to be available on a limited number of keys, whether it be xbox or ps3 controller (both of which i’ve used in the past to play lol and developed RSIs using both).

My problem now is that i can’t find any other youtubes or other tutorial sources that discuss what happens when leonardo is acting as a game controller.  I can only find stuff about the out-of-the box keyboard and/or mouse capabilities.

Can someone please point me in the direction of where i can get basic understanding of some things?

To begin with, i’d like to see and test an example of how to wire up a single switch to the board along with a sketch that causes the button to act as one of the buttons recognized by windows as a game controller button’s input.

From the comments for the instructable above...
“Connecting one button to an Arduino
is easy. You can just connect one side of the button to ground and the other side
to a digital input pin.”

So i guess that’s easy enough.  But i still need a sketch that invokes the board’s internal pin resistors and tells the pin to be an input that sends a game controller button activation to the PC right?
If someone can help me with that, i’d really appreciate it. 

Going forward, i gather that i will be limited to the 13 available pins on the board for my total switch count unless i use this...

http://forum.arduino.cc/index.php?topic=8558.0

or this...

http://www.instructables.com/id/How-to-access-5-buttons-through-1-Arduino-input/

neither of which i want to bother with due to my skill level.


Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 12:07:23
one more thought about desire to have xpadder involved.

something like alt keymaps are certainly possible in keyboard mode by just mapping commands to keyboard combos like ctrl + a.  but this approach limits to only 3 possible alt key commands by using the ctrl, alt, and shift keys.  that's not a big problem perhaps.  but it's better to have 4 keymaps available by using xpadder in my experience. 

also, some games don't like certain keyboard combos.  for example, a game might allow ctrl + something, but for whatever reason it may not allow 'alt' + something.

also, analog stick adjustments for use as a digital camera control in league are very easy in xpadder as they can be done in the xpadder interface which is a gui instead of coding.

anyway, i suppose i can live without xpadder if it's not possible or practical to use it here.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 13:11:24
*oh, i forgot that AdryD posted earlier in this thread how to connect a single switch /w a sketch for it using internal pulldown resistor.  i think i'll try this...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 08 November 2015, 13:20:53
You've gone beyond my knowledge of windows and gaming controllers, but is this (http://www.instructables.com/id/Add-USB-Game-Controller-to-Arduino-LeonardoMicro/) how you want it to show up?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 13:28:50
wired up this here

[attach=1]

and uploaded this sketch from AdryD's post:

Code: [Select]
void setup(){
  pinMode(2,INPUT_PULLUP);
}
void loop () {
}

as expected, it doesn't do anything.  i checked to see if a game controller button would be recognized or any keyboard input.  i guess it's pretty obvious there is a need for some code to do that. 
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 13:32:45
You've gone beyond my knowledge of windows and gaming controllers, but is this (http://www.instructables.com/id/Add-USB-Game-Controller-to-Arduino-LeonardoMicro/) how you want it to show up?

yep, i was able to get the board to show up succesfully as a game controller just as in that instructable.  and then i launched xpadder and found that the leonardo board was available to be configured just as any gamepad.

at this point, i just need to know how to connect the buttons to the board and get the board to send each button's press to the pc as a gamepad button activation.

in other words, i need to get something to light up here when a button is pressed
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 08 November 2015, 14:33:27
I don't have an Arduino handy but think this should work for one button, it compiles ok...

Code: [Select]
boolean oState = HIGH;
boolean buttonState = HIGH;

void setup() {
  pinMode(2,INPUT_PULLUP);
  Joystick.begin();
}

void loop() {

  buttonState = digitalRead(2); //read physical button 2
   
  if(buttonState != oState) { //check against previous button state, if changed do something
    if(buttonState == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState = buttonState; //save state to compare next time
  }
}

From reading the example sketch I have no idea how they connected their many buttons...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 14:34:43
can someone tell me a good wire to buy?  i already have solid core hookup wire from sparkfun for building the main parts of this project.

but i need some stranded wire for something.

the project will be like this...

handset switches soldered to solid core wires terminating at the bottom of the handset =>

about 1 meter of stranded wires soldered to the ends of each of the switches' solid core wire connections.  this meter of wiring goes between the handset and the project box which will house the board and will sit on desk.  these wires will be housed in a wire mesh, wire loom like this:

https://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=51285

the board will just be connected to pc via usb, so i don't need any help with that.

any suggestions on a good place to buy 22awg or 24awg stranded wire for the 1 meter of wiring that goes between the handset and the project box?  22awg or 24awg would be suitable right?  it needs to be stranded wire for flexibility right?  solid core breaks after a lot of movement i would guess.

hobbyking doesn't seem to have any suitable wires. anyway, i built this in 2014 almost entirely out of hobbyking parts and found the hobbyking shopping experience to be pretty undesirable...

https://endless-sphere.com/forums/viewtopic.php?f=35&t=55422&start=75#p865840

also, adafruit doesn't seem to have any wire like this and their shipping is expensive.

sparkfun's shipping charges are great, but no stranded wire there :'(

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 14:50:38
I don't have an Arduino handy but think this should work for one button, it compiles ok...

Code: [Select]
boolean oState = HIGH;
boolean buttonState = HIGH;

void setup() {
  pinMode(2,INPUT_PULLUP);
  Joystick.begin();
}

void loop() {

  buttonState = digitalRead(2); //read physical button 2
   
  if(buttonState != oState) { //check against previous button state, if changed do something
    if(buttonState == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState = buttonState; //save state to compare next time
  }
}

From reading the example sketch I have no idea how they connected their many buttons...

oh hell yes :p

it works and i just immediately launched xpadder, mapped the single button to F, launched league custom single player game to test and flashed (made kha'zix, a league champion, blink forward) with my leonardo board!

must be over 3 months i've been waiting for true signs of life from this project, and this is it ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 08 November 2015, 14:56:04
Thin wire, and lots of it?  You could get some on amazon (http://www.amazon.com/NTE-Stranded-AWG-Hook-Up-Wire/dp/B005S3MMU0%3FSubscriptionId%3DAKIAILSHYYTFIVPWUY6Q%26tag%3Dduc08-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB005S3MMU0) (random example, may be available cheaper/in a more appropriate quantity) or if you have any Cat 5e Ethernet cables lying around at home/work/school they contain 8 strands of 24AWG.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 14:58:05
Thin wire, and lots of it?  You could get some on amazon (http://www.amazon.com/NTE-Stranded-AWG-Hook-Up-Wire/dp/B005S3MMU0%3FSubscriptionId%3DAKIAILSHYYTFIVPWUY6Q%26tag%3Dduc08-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB005S3MMU0) (random example, may be available cheaper/in a more appropriate quantity) or if you have any Cat 5e Ethernet cables lying around at home/work/school they contain 8 strands of 24AWG.

oh yeah thanks, this would probably work quite well :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 14:59:58
I don't have an Arduino handy but think this should work for one button, it compiles ok...

Code: [Select]
boolean oState = HIGH;
boolean buttonState = HIGH;

void setup() {
  pinMode(2,INPUT_PULLUP);
  Joystick.begin();
}

void loop() {

  buttonState = digitalRead(2); //read physical button 2
   
  if(buttonState != oState) { //check against previous button state, if changed do something
    if(buttonState == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState = buttonState; //save state to compare next time
  }
}

From reading the example sketch I have no idea how they connected their many buttons...

yeah i don't know how to add more buttons either.  i tried jumping in and doubling some of the code for another button but couldn't get too far without becoming lost :D

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 15:23:27
Thin wire, and lots of it?  You could get some on amazon (http://www.amazon.com/NTE-Stranded-AWG-Hook-Up-Wire/dp/B005S3MMU0%3FSubscriptionId%3DAKIAILSHYYTFIVPWUY6Q%26tag%3Dduc08-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB005S3MMU0) (random example, may be available cheaper/in a more appropriate quantity) or if you have any Cat 5e Ethernet cables lying around at home/work/school they contain 8 strands of 24AWG.

i might try some cat 5e cable because it's meant for external rather than internal hookup applications.  anything labeled as hookup wire might have a limited lifespan in this application where movement is involved.  but cat 5e must use a rubber housing that's meant for a good deal of movement without cracking :rolleyes:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 15:37:23
can't seem to find a decent project box.  you'd think there would be many.

this one looks cool, but too small to fit the shield >:D

https://www.tindie.com/products/akafugu/project-box-for-arduino/
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 08 November 2015, 15:43:10
Glad to hear it worked!

My code is not complex enough to handle more switches than you have pins (you'll need to know where the switch connected to as well as which switch - this is called a switch matrix) but it would be good if you could work out how to add a second button as it's only going to get harder from here on in.  Perhaps a written explanation of the code will help?

The loop() function repeats indefinitely.  The first thing it does is check the current state of the switch and record it, then it compares this state with the previous one - did it change?  If it did then it checks what the new state is and informs the computer of it.  Then it saves the new state in oState ready for next time.  If on checking the state hasn't change (not pressed or released) nothing happens and it skips back to the top.

You could duplicate everything in loop() and make a pair of variables for each button, or better you could make a for loop (http://startingelectronics.org/software/arduino/learn-to-program-course/07-for-loop/) around the existing code to go through all the pins and update that number-1 button.  I will say no more today, have a play :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 15:46:16
maybe this...

http://www.ebay.com/itm/Acrylic-enclosure-for-Arduino-Uno-project-transparent-orange-Made-in-USA-2x-high-/231742155419?hash=item35f4e8aa9b:g:G9MAAOSwAYtWLQJD
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 16:04:22
"I will say no more today, have a play :)"

lol, yeah trying now ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 16:08:33
Code: [Select]
boolean oState = HIGH;
boolean buttonState2 = HIGH;
boolean buttonState3 = HIGH;

void setup() {
  pinMode(2,INPUT_PULLUP);
  pinMode(3,INPUT_PULLUP);
  Joystick.begin();
}

void loop() {

  buttonState2 = digitalRead(2); //read physical button 2
  buttonState3 = digitalRead(3); //read physical button 3
 
  if(buttonState2 != oState) { //check against previous button state, if changed do something
    if(buttonState2 == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState = buttonState2; //save state to compare next time
  }
 
  if(buttonState3 != oState) { //check against previous button state, if changed do something
    if(buttonState3 == LOW) { //button has been pressed
      Joystick.pressButton(1); //press "joystick" button 2
    }
    else { //button has been released
      Joystick.releaseButton(1); //release "joystick" button 2
    }
  oState = buttonState3; //save state to compare next time
  }
}


my lame attempt to build out the code for 2 buttons. it works a little bit. it compiles and uploads ok.  and i can press the buttons and get them to register on game controller settings in windows as below

[attach=1]

problem is, as seen in the pic, the buttons won't release.  i've physically released the button 1, but the pic shows it's still being pressed down :'(

anyway, good progress for today i'd say.  thanks for all the help ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 16:16:09
hey i got it to work ^-^

Code: [Select]
boolean oState2 = HIGH;
boolean oState3 = HIGH;
boolean buttonState2 = HIGH;
boolean buttonState3 = HIGH;

void setup() {
  pinMode(2,INPUT_PULLUP);
  pinMode(3,INPUT_PULLUP);
  Joystick.begin();
}

void loop() {

  buttonState2 = digitalRead(2); //read physical button 2
  buttonState3 = digitalRead(3); //read physical button 3
 
  if(buttonState2 != oState2) { //check against previous button state, if changed do something
    if(buttonState2 == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState2 = buttonState2; //save state to compare next time
  }
 
  if(buttonState3 != oState3) { //check against previous button state, if changed do something
    if(buttonState3 == LOW) { //button has been pressed
      Joystick.pressButton(1); //press "joystick" button 2
    }
    else { //button has been released
      Joystick.releaseButton(1); //release "joystick" button 2
    }
  oState3 = buttonState3; //save state to compare next time
  }
}

heck, if weren't for the darned analog stick which is probably going to be the death of me, i could probably finish this project on my own from here :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 08 November 2015, 16:47:02
Haha, you were so close I nearly posted but thought you'd spot it :)  If you had enough pins to do one button on each, no analog stick, and didn't mind a bit of lag you'd be good but you still have all that fun stuff to overcome.

May as well do the analog next as that's independent of everything else...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 08 November 2015, 17:18:19
Nice, you have gotten this far :)

I will tell few things from my experience regarding joysticks.
Those buttons in the sketch are wired as "INPUT_PULLUP" , which means the value returned is 1 when not pressed and 0 when pressed. Don't know if you knew this already, but its a good thing to realize when you start to write more code yourself. In my experience it is much better to use "INPUT_PULLUP" (active low) instead of the regular "INPUT" (active high). At least on bare teensy boards driving a pin to 5v has caused some bad oscillations on the other pins on me on the past.

I haven't read through the code for that joystick yet, but if it sends the USB code every time you call "Joystick.pressButton()", you will start noticing some bad lag after 10-20 buttons. But this is something more advanced and fixable later, so i wouldn't worry about that now. Just something to keep in your mind for later, if you start noticing some input lag.

About the wire, 30AWG (often called also "kynar wire" for some reason) is enough for buttons. If you dont like handling it, because of the thickness. You can get thicker one, but there is no other reason.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 17:21:37
lol.  yeah this analog stuff is going to be something :eek:

the part from the Fin
[attach=1]

think i could do that?  look at that thing!  money well spent ;D

it came in a hand cut foam padding that i'm gonna use in the final application to house this precious piece :cool:
[attach=2]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 08 November 2015, 17:28:21
good to know i will need to upgrade code to avoid lag.

i checked kynar wire and found that it's solid core.  i like the thin size, but won't this wire break after being moved around a lot?  it looks like it's only good for internal applications
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 08 November 2015, 18:00:47
Premium packaging :D
i checked kynar wire and found that it's solid core.  i like the thin size, but won't this wire break after being moved around a lot?  it looks like it's only good for internal applications
Yes, you only bend it once (or twice, but no more than that). And mostly only for internal applications.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 09 November 2015, 02:26:15
Nice, you have gotten this far :)

I will tell few things from my experience regarding joysticks.
...

Welcome to the party W11cE, sounds like you bring some much needed experience with this stuff :)

Just to clarify you meant to say it's better to use "INPUT_PULLDOWN" so the Teensy has less live pins causing less interference?  Makes sense...

By default the Joystick does update on button press but there's an option to do it manually.  As you say, one for later!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 09 November 2015, 22:11:27
i just tried running this sketch from W11cE tutorial here

http://xim4.com/community/index.php?topic=31390.0

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

#define OVERVAL 256
int Xstick;
int Ystick;



void setup() {
  pinMode(0, INPUT_PULLUP);
  pinMode(1, INPUT_PULLUP);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, 0, 1024);
  Xstick = constrain(Xstick, 0 , 1023);
  Joystick.X(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 1024, 0);
  Ystick = constrain(Ystick, 0 , 1023);
  Joystick.Y(Ystick);

  Joystick.button(1, !digitalRead(0));
  Joystick.button(2, !digitalRead(1));
 
}

and got this error message

Quote
Arduino: 1.6.5 (Windows 7), Board: "Arduino Leonardo"

vita_stick_1.ino: In function 'void loop()':
vita_stick_1:19: error: 'class Joystick_' has no member named 'X'
vita_stick_1:22: error: 'class Joystick_' has no member named 'Y'
vita_stick_1:24: error: 'class Joystick_' has no member named 'button'
vita_stick_1:25: error: 'class Joystick_' has no member named 'button'
'class Joystick_' has no member named 'X'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

i'm guessing there should be something under this?

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

but i don't know what to use to define sticks.  are they booleans? :confused:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: sinusoid on Tue, 10 November 2015, 02:44:08
Hey, awesome project!

For inspiration, some old Steve Mann stuff:
(https://upload.wikimedia.org/wikipedia/commons/b/b9/Septambic_key_numbering.jpg)
note the beautiful manicure  ;D

Protip: use wire for prototyping shape. 1mm soft steel wire, or copper. Tie it in bunches (duct tape, hot glue, twist it, whatever), shape the outlines of your prototype, fill in with sugru, or epoxy putty, or alu foil + sculpey + bake... whatever rocks your boat :)

That way you can work on the entire shape of the model at the same time.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Tue, 10 November 2015, 16:15:13
That code is for my modified teensy joystick usb type.
I modified this, so now it "should" work (haven't compiled this!):
Code: [Select]
#define STICK_X 0
#define STICK_Y 1

#define OVERVAL 0
int Xstick;
int Ystick;

boolean oState2 = HIGH;
boolean oState3 = HIGH;
boolean buttonState2 = HIGH;
boolean buttonState3 = HIGH;


void setup() {
  pinMode(2,INPUT_PULLUP);
  pinMode(3,INPUT_PULLUP);
  Joystick.begin();

}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
 
   buttonState2 = digitalRead(2); //read physical button 2
  buttonState3 = digitalRead(3); //read physical button 3
 
  if(buttonState2 != oState2) { //check against previous button state, if changed do something
    if(buttonState2 == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState2 = buttonState2; //save state to compare next time
  }
 
  if(buttonState3 != oState3) { //check against previous button state, if changed do something
    if(buttonState3 == LOW) { //button has been pressed
      Joystick.pressButton(1); //press "joystick" button 2
    }
    else { //button has been released
      Joystick.releaseButton(1); //release "joystick" button 2
    }
  oState3 = buttonState3; //save state to compare next time
  }
 
 
}

If i read the code correctly it is expecting axis value between -127 to 128 (or 127 ?). Which i think is a little wrong since 8 byte integer range is from -128 to 127. This should not cause problems, it is just bothering me.

Welcome to the party W11cE, sounds like you bring some much needed experience with this stuff :)

Just to clarify you meant to say it's better to use "INPUT_PULLDOWN" so the Teensy has less live pins causing less interference?  Makes sense...

By default the Joystick does update on button press but there's an option to do it manually.  As you say, one for later!
Thanks, I though you already have more experienced people on this forum?

I was not thinking completely what i remembered and wrote. This "active high" case was with "INPUT" without pulldown resistors. So, ofcourse it causes problems because it is just dropping back to floating position, which was just most of the time LOW. This was few years ago, when I wasn't that experienced yet.
Anyway, "INPUT_PULLDOWN" is not that widely supported, unlike "INPUT_PULLUP" which is supported by every(?) board. That is already a good argument to use "INPUT_PULLUP".
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 10 November 2015, 16:50:50
Thanks, I though you already have more experienced people on this forum?

There are some skilled coders here but they mainly write firmware to handle a large switch matrix as a USB keyboard.  There is also Swill who writes cool stuff (a plate CAD file generator and a PM search tool) but from the lack of input in this thread I can only assume no-one does joysticks.  That or they mistakenly think I know what I'm talking about (I don't - I'm learning as I go :))) and are leaving me to it...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 10 November 2015, 17:02:45
these posts are the funnest part of my day. thanks guys ^-^
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 10 November 2015, 17:29:01
i've been saying to myself that it isn't rocket science to make a game controller that not only has a lower potential for RSIs but also actually improves control (this whole aspect of the design wherein many buttons (many more than an X360 pad, for example, are available without finger or thumbs picking up and repositioning (for the most part).

but Steve Mann might as well be a rocket scientist.  so i guess it takes either a rocket scientist or an old guy with pain :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 10 November 2015, 17:33:25
Code: [Select]
#define STICK_X 0
#define STICK_Y 1

#define OVERVAL 0
int Xstick;
int Ystick;

boolean oState2 = HIGH;
boolean oState3 = HIGH;
boolean buttonState2 = HIGH;
boolean buttonState3 = HIGH;


void setup() {
  pinMode(2,INPUT_PULLUP);
  pinMode(3,INPUT_PULLUP);
  Joystick.begin();

}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
 
   buttonState2 = digitalRead(2); //read physical button 2
  buttonState3 = digitalRead(3); //read physical button 3
 
  if(buttonState2 != oState2) { //check against previous button state, if changed do something
    if(buttonState2 == LOW) { //button has been pressed
      Joystick.pressButton(0); //press "joystick" button 1
    }
    else { //button has been released
      Joystick.releaseButton(0); //release "joystick" button 1
    }
  oState2 = buttonState2; //save state to compare next time
  }
 
  if(buttonState3 != oState3) { //check against previous button state, if changed do something
    if(buttonState3 == LOW) { //button has been pressed
      Joystick.pressButton(1); //press "joystick" button 2
    }
    else { //button has been released
      Joystick.releaseButton(1); //release "joystick" button 2
    }
  oState3 = buttonState3; //save state to compare next time
  }
 
 
}

this code compiles and uploads fine :thumb:

but in reading over the code, i can't figure out which pins the analog stick connects to.  i can see in this sketch that 2 buttons are connected to pins 2 and 3, but where to connect the pins coming from the analog stick?

there are 4 pins coming from the analog stick i will have to solder some hookup wire onto.   can someone tell me where those 4 wires should be inserted into on the board?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 10 November 2015, 17:59:36
Pin 0 is X and pin 1 is Y as defined at the top - they are what gets "analogRead".  The other two pins need to be connected to ground (marked GND) and 3.3v.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 11 November 2015, 00:04:15
W11cE, can i trouble you to tell me what each of these pins is for?
[attach=1]
i checked your tutorial but couldn't figure it out because the wires in your pics are different colors from the text that tells x, y, ground, and power

thanks ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 11 November 2015, 02:56:57
Comparing your adaptor with the pic below I think the soldered bit of your left of middle wire goes up and left, the right of middle straight up and the right one goes sideways, across 3 traces?  If so it's GND, X, Y, 3.3v as 1-4

(https://drive.google.com/uc?id=0B_0MQrj9_eGtcG50VURueWk3bDA)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Wed, 11 November 2015, 13:40:12
Yes, just like that.
1 GND
2 X
3 Y
4 5V

And notice that when you are using "analogRead", 0 means analog 0.
NOT the same pin 0 which you use with digitalRead. Yeah, does not make any sense, but thats how it was originally written.

So, you would use "A0" for X and "A1" for Y.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 11 November 2015, 13:53:09
thanks guys :thumb:

black clay arrived today.  been doing some design work and look forward to adding the next row of keys leg :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 12:33:46
it isn't getting any prettier, but it feels like it will work really well.  i fear sugru as the coupling material between legs 1 and 2 at the top will not be sufficient for rigidity and the device will require an icecream stick at the bottom to prevent flex when hitting outside keys.  i really didn't want anything on the bottom so that just my palm can rest on my leg instead of a foreign object.  we'll see later on when the sugru has cured overnight :rolleyes:
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 12:56:36
today yielded a great success :D followed by crushing defeat :'(
[attach=1]
[attach=2]
[attach=3]
i can't imagine why the Win7 game controller properties recognizes the X Axis/ Y Axis movement but xpadder doesn't see it the way it should.  usually when setting up an analog controller in xpadder, you click enabled in the sticks setup area, and the dialog box asking you to move the stick left pops up.  then right, up, and down. thereafter, the directions of the analog stick are mappable.  but in this case, the dialog box asks for the stick to be pressed left, and i do.  but nothing happens.

[attach=4]

i have managed to get xpadder to see the analog stick's movements in one way.  by selecting x axis and y axis in the setup pictured above, the stick's movements register, but only in one direction.  and they're registering as continuous-on unless i wiggle the stick.  this probably has something to do with the fact that the at-rest position is in the lower left quadrant instead of dead center. 

i've already started doing some poking around the interwebs about xpadder recognizing analog sticks and will do some more.  but i'm stuck at this point >:D any ideas?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 13:12:41
another pic with controller properties details in xpadder in case it helps
[attach=1]

the x axis green indicator is twitching a bit, but not enough to affect gameplay i'd guess.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 14 November 2015, 13:31:08
Nice to see some signs of life, but that doesn't look great.

What are the minimum and maximum values you can get in that last screenshot?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 13:31:43
nevermind.  going into settings in Win7 game controller properties and doing the calibrate wizard solved the problem ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 13:33:44
properties after problem is resolved by doing calibration.  does this answer your question orange?
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 13:35:24
wait, hold on..
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 14 November 2015, 13:38:58
I was going to calibrate in firmware, but that's looking good.  It was probably remembering the values from your previous controller whatever that may have been :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 13:39:41
the green bars for x and y go all the way up to full, and all the way down to nothing.

the analog stick will be used for digital input in league, and the stick is working perfectly in xpadder now with u, d, l, and r mapped to the arrow keys.  seems i won't have to deal with any scaling or adjusting overval or anything else. seems to be working perrrrrfectly :p


launching league now to test in-game camera control...

patching...

5%

these league patches can take a while :rolleyes:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 13:41:30
yeah, previous setups might have confused xpadder.  i've got 2 different xpadders on this system which i don't like.  probably will clean them all out and do a new xpadder installation at some point
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 14:04:10
camera control works in league :thumb:  and on this vita stick, it's sublime :D

i can see why others have gone to such lengths to get this stick into orbweavers and such.

other than needing someone to write me a 13 button sketch that doesn't have potential for excessive lag, i can probably handle the rest of this project because its just a matter of crafting/construction at this point :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 14:07:32
it's 13 buttons right?  even after taking AO and A1, there are 13 available Digital I/O pins i'm free to fill up with buttons i assume.  that'll be plenty with alt-keymaps from xpadder :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 14 November 2015, 14:18:53
another note on alt-keymaps.  thumbsticks present great possibility with alt-keymaps.  a thumbstick can essentially act as 4 buttons.  this means one appendage can activate 4 commands without traveling anywhere.  that's really useful.  using a thumbstick as camera control is great, but it doesn't end there.  not even close.

now add just one alt-keymap by hitting an outside leg key, and the thumbstick now gives you all 4 pings in league.  set another outside key to another alt-keymap, and you've got 4 more commands available in the thumbstick.  that takes care of dance, taunt, laugh, and whatever else. 

point is, thumbsticks in games with alt-keymaps offer a lot of possibilities :cool:

i had my x360 controller really tricked out with xpadder using trigger and bumper for alt-keymaps... until the RSIs came anyway :-[

now if Riot would just make that darned radial ping picker compatible with alternative pointing devices like a Wii remote or pen tablet, those of us who can't mouse anymore, due to the trauma those things cause, wouldn't have to set up 4 separate commands just for pings :mad:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 14 November 2015, 19:58:32
If I'm understanding this right all the actual commands the buttons do will be configured in xpadder, so you just need to update the button statuses?

Pretty sure that means you just need 13 pins (one per switch) setup with an "on change" interrupt, with the main thread running the analog stick.  If you can run an interrupt routine including the pin that triggered it this code might be even smaller than the two button example above!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: jaffers on Wed, 18 November 2015, 10:12:05
I'm really liking this thread so far! Great work and a really unique design, I think I have found a project for next year.

I'm interested to see how it will all turn out
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 18 November 2015, 12:39:03
I'm really liking this thread so far! Great work and a really unique design, I think I have found a project for next year.

I'm interested to see how it will all turn out

glad to hear you're liking this thing :)  and thanks for checking it out and giving encouragement.

project appears to be in intermediate stages and will possibly be usable within 30 days with final wrapup after certain refinements are implemented in around 60 days if all goes well.

thus far not mentioned design point will be a thin layer of sugru over the clay to encase it and make it dirt proof. 

https://sugru.com/guides/how-to-apply-a-super-thin-layer-of-sugru-to-anything

i've wondered for a while how to deal with durability and getting dirty problems of handling clay over and over again as a game controller.  but with the thin layer of sugru idea above, i think i've solved that problem and am pretty excited about it.

cosmetics...

i have a plan to lay a flat wire into the clay to create a design such a racing stripe type of thing.  then i will lay one thin layer color of sugru into the channel created by the flat wire, perhaps white.  then i will lay another color of sugru onto the surrounding sections, perhaps red.  then i might order some white keycaps to really set this thing off.  i could just stick with black, but why not go nuts with cosmetics? ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 18 November 2015, 13:12:37
more work...

had to cut the handset apart due to the need to redo a botched angling job on the outside leg.  this is the primary palm leg from which the outside leg anchor has been cut out...
[attach=1]
[attach=2]
[attach=3]
cutting cured sugru is very easy and effective.  i was able to slice out the leg anchor and cut a new channel with the corrected angle very easily.

some unexpected things have happened when implementing the build to be optimally ergonomic.  the angling work is turning out to be important and a lot more involved than i originally expected.

i mean, you look at a keyboard or an orbweaver and you think, 'herpty flerp, keys go in straight lines'.  well, not here as most guys here have probably realized before me.

every key has the need to be positioned just right, and each key must have a unique tilt in alll directions to face and contact the finger just right, inside and out.

look at how severe the relative positions and tilts are on the keys (this is the outside leg).  i really didn't expect this.
[attach=4]
[attach=5]
[attach=6]

with all of these fine tuned positions and tilts, i've managed to get an excellent fit for very comfortable and low-effort activation of keys...

[attach=7]
[attach=8]

i have yet to re-sugru the outside leg into place yet, which is why i'm having to hold it in place.  i plan to do it today.  but all seems to be that the device will actually work for effective gaming control.

by the way, i lied in an earlier post when i said i had managed to nail the angle of the icecream stick which will serve as the bed for the analog stick in a way such that zero extension out of the at-rest position is required of the thumb.

in the at-rest position, my thumb and probably anybody else's is actually touching the index finger as here
[attach=9]
as mentioned before, one of the reasons i chose the vita stick is for its low profile which would allow me to construct this thing with thumb positioning as close as possible to the at-rest position.  unlike my orbweaver which forces the thumb well into something like 80% into the max range of extension - yuck!

anyway, in my build, the thumb is just over an inch away from the at-rest position when the vita stick is in place on the icecream stick.  i actually did nail the angle of the icecream stick when sugru-ing it into place as far as allowing the thumb to get as close as possible to the index finger and in terms of how the analog stick ends up coming into contact with the pad of the thumb.  but there's no way to have nothing in between the thumb and index finger allowing for zero extension.  there's got to be a base and the analog stick itself. 

at any rate, by my estimate from eyeing it, the extension requirement is about 25% into the range of possible extension.  not perfect, but i don't think there's any way to do better, and this amount of extension shouldn't be a significant contributor to RSI from long-term use :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 18 November 2015, 13:28:19
it will be time soon to tear down the whole thing save for the parts that are sugru-ed in order to do a wireup and final assembly with a total re-claying.  when i do that, i can spend the time to smooth out all the ugly bumps and and notches and coat it in a smoothed out fine layer of sugru as mentioned before.  i'd like this thing to look nice to the extent possible.

one funny idea my fiance had was to make the keys look like teeth with some stickers or something.  this thing already kind of looks like a monster head biting my hand :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 18 November 2015, 15:00:35
If I'm understanding this right all the actual commands the buttons do will be configured in xpadder, so you just need to update the button statuses?

Pretty sure that means you just need 13 pins (one per switch) setup with an "on change" interrupt, with the main thread running the analog stick.  If you can run an interrupt routine including the pin that triggered it this code might be even smaller than the two button example above!

yep, all i need is more of the same we have achieved so far in terms of info sent to the pc.  so far, the sketch just tells the pc that game controller buttons 1 and/or 2 are getting pressed and the analog stick is moved U, D, L, and R.  don't need anymore from the arduino because as you asked about, xpadder will do all of the actual key-send assignments.

the sketch could be so simple and small?  that'd be mighty fine ;D

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: sinusoid on Wed, 18 November 2015, 15:20:03
This thread is totally AWESOME

I didn't expect you'd aim for such a tight fit on the fingers, this begins to look really epic! Begs for some hardware chording :P

Working with clay-like stuff for organic design is great, you get results that are near impossible to even approximate in digital design. Measuring results for 3d printing is hell too. But the slight turns of keys, minute differences in height, angles etc... those things are what makes a keyboard truly ergonomic.

I'll bomb your thread with some more stuff if you don't mind! (if you do, let me know, I'll carve this out)

I was researching into the effective reach of fingers and corresponding placement of keys, to max out the key density, and minimize the amount of reach you have to perform to press each of the buttons... and the result was something like this:
(http://creatr.es/gh/shk2.jpg)
(http://creatr.es/gh/shk.jpg)
Alu foil and oil clay with keys ploughed out from some cheap Cherry rubberdome, used up most of they keys, and this is VERY comfortable.

My experiences were very similar to what you're writing about. Later I tried transferring this to digital and 3d printing, but as it turned out, the slight changes in key positioning were really crucial! The feel of the 3d print was really different.

If you wanna get a nice finish on sugru, try flattening a bit of it with a rolling pin, cut up into stripes/squares, and place them over the original.
Sugru is silicone based, so you can use caulking silicone with it, it should bind very well.
You can use a bit of mineral oil to polish both of these into hi-shine before it sets... as far as I remember... so try these things first on a sample if you want to attempt that.

Anyway, good luck with this! Waiting for more progress!  :D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 18 November 2015, 15:36:55
I just checked, the Leonardo only has 5 pins which support interrupts so no super-easy solution.

I'm now trying to get my head round whether a 3x5 matrix could work where you cycle between the 3 and use the 5 on the interrupt pins.  Would it need diodes?  Can you switch what each interrupt does and keep track of all the statuses any quicker than just scanning?   Also you have your keys in blocks of 4 so perhaps a 4x4 would work better with wiring in mind, though that would make it slower.  Maybe 4x3 plus an odd one?

Think I need to get my breadboard out and have a play :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 18 November 2015, 23:30:47
This thread is totally AWESOME

hi friend thanks for your support.  indeed, with the help that these guys have given on this outstanding forum, this thread is indeed AWESOME ^-^  really, this project has been a breeze with the help i'm getting :-*

the pic of your work is only viewable on my tablet for some reason.  in firefox, i can't see the pics.  anyway, i saw them and that's some serious work you've done :cool:

yep, i can what you've done must be totally comfortable.  bravo :thumb:


My experiences were very similar to what you're writing about. Later I tried transferring this to digital and 3d printing, but as it turned out, the slight changes in key positioning were really crucial! The feel of the 3d print was really different.

yep, i realized early on that drawing this thing on a computer 1st would just result in an endless series of expensive 3D prints which would cause a lot of frustrating redos due to the hundred minute adjustments that can really only be made in the physical world with something in your hand.  I'm having enough redos as it is in hand.  had to cut out yet another botched sugru angling job on the outside leg today because of some bright idea i had to put a .... well it's not important.  point is, i'll be done screwing this thing up soon and get it right.   and then i can move onto actually getting the device ready to put to use ;D

i don't know how this thing could be later scanned without a straight up pro design studio getting involved... :-X

as you said, it would have to be done without the results coming out with a different feel because one millimeter off, and this thing not only doesn't feel right, it really doesn't work.  it seems when creating an input device for fingers that aren't supposed to move at all, no finger dancing, the positioning has to be absolutely spot on, which isn't easy to achieve.

one thing you might be able to relate to from your experience.  when taking the fingers into a curled position to reduce strain potential rather than having them straightened out and dancing, funny things happen.  for example, in my application, when wanting to move my ring finger to hit an outside key, my pinky wants to pop up too :confused:

even the inside keys sometimes see this weird hand event.  pulling my middle finger to hit inside key, my ring finger or maybe another one sometimes pulls too.  luckily, this not entirely unexpected side effect of this design doesn't appear to be a functionality killer.  seems like it will just take some muscle memory work such as when learning to do this :))
[attach=1]

widespread appeal for this design may be limited by the learning needed to use it effectively because of this.  i've done enough fiddling around with it on my own though to see that it will likely allow me to return to league without a problem *crosses fingers* 

like when one of my other fingers pops up or pulls unintentionally, it doesn't depress its corresponding key enough to activate it.  it just sort of bumps up against it as my intentional finger does its work.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 18 November 2015, 23:35:31
I'm now trying to get my head round whether a 3x5 matrix could work where you cycle between the 3 and use the 5 on the interrupt pins.  Would it need diodes?  Can you switch what each interrupt does and keep track of all the statuses any quicker than just scanning?   Also you have your keys in blocks of 4 so perhaps a 4x4 would work better with wiring in mind, though that would make it slower.  Maybe 4x3 plus an odd one?

Think I need to get my breadboard out and have a play :))

thanks for looking into this orange.  your help continues to be invaluable :-*
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Thu, 19 November 2015, 10:44:19
Interrupts are overkill for something like this. The usb polling is minimum 1ms (don't know what it is in this code), which gives a lot of time for processing stuff.

If you have enough pins there is no reason for a matrix. Harder to use and probably more latency (have not measured), because all the buttons are polled separately on software.

I may be able to help with the code in 1-2 weeks. I have some other projects right now.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 20 November 2015, 00:30:38
yeah thanks a lot for offering to help with the code guys.  that's my weakest area here.

at this point, i'm ready to lay all the parts uninstalled from the handset out on a table and wire it all up with a sketch that works.  and then i'm ready to slap it all together for some barely held together test runs :cool:

did some testing today with the handset.  nothing wired, just testing hand mechanics.  i don't have the analog stick or the 3 top buttons from my original design stuck on yet, but i've got all 8 leg keys stuck in place and have finally gotten all the angles right.

So, I was able to run through a bunch of key pressing tests. Good news, the device seems to be effective ^-^

I would say that if someone is young and doesn't have any hand problems, they could just buy an orbweaver and be fine. This device probably doesn't improve on game control at all.  in fact, i'm not sure it could even realistically equal it.  finger dancing is hard to beat. But from what I can see, I really think this device will cause less long-term trauma.

It also appears to allow for some pretty dexterous key pressing and combos, dextrous enough to play anyway.  though, the combos that can be performed fluidly are limited, call them grade 1 combos. There are numerous other possible combos that can be performed with minor effort, something like a grade 2 combo.

Luckily for me, the device allows for enough grade 1 combos to cover the necessary ones in league.

There are so many other important commands in league however. From what I have tested today, it seems this device will allow for a total of around 34 reasonably comfortable commands. It's capable of more, however they require hand movement combinations that the hand just doesn't want to do easily.  34 is definitely enough, so things are looking good :thumb:

Here's some more news, when getting down to business with this thing and testing the mechanics, I have found that it can't be used just held in the air. I was annoyed before about how the outside leg was too long and planned to shorten it. But I have found that it needs to be rested on your leg.  It's not because the body has some flex that allows the outside leg to wiggle in and out a little bit. That actually annoyed me a lot, and I was considering cutting the whole thing apart again and getting much deeper anchor. But I found that flex isn't a problem. But there is a problem with rotation.

The hand rest from my original design was for the purpose of preventing the handset from moving out of the palm when hitting outside keys. But I did some testing, and I'm just not convinced that any kind of hand rest that wraps around the back of the hand will effectively prevent this. And it's pretty pronounced when it happens. The inside leg gets ever so slightly pulled out of position when hitting the outside keys without anchoring the outside leg. Even though the inside leg only gets moved and rotated a tiny bit, because of leverage, there's quite a bit of movement in the outside leg. And it creates a very awkward, loose, undesirable tactile feedback feeling.

But, it's not a problem at all. With the way the outside leg ended up getting cut too long, it turns out to be the perfect length to have butted downward against your thigh while your hand sits on your leg. The pressure isn't uncomfortable at all, and is just enough to prevent the device from moving. With it resting on my lap like that, I was able to hit all the keys with no problem, rapid firing, key combos-it all works really well like that :thumb:



Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 21 November 2015, 10:39:46
i've planned out the wireup today. it will result in a very large cable between the handset and the project box.  Based on the current design, there will be 24gauge wires with a total count of 26 coming from the handset.This could be a little bit unwieldy, but I can't think of any alternative way that would be easy and suitable.

Assembling the device like most commercial products which have the board in close proximity to switches would require that I somehow affix the Leonardo and proto-Shield to the handset itself, and I'm just not liking that idea.

Based on what I can guess as an approximation, the cable that will be coming from the handset will be three times the size of Cat5e.

It doesn't really matter. As long as the device works well and isn't too outrageous looking, I'll be happy ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 21 November 2015, 11:00:19
You need one wire that connects to each switch plus one that connects to all of them, and then four for the analog - I make that 20 wires.  What are the other six for?  Actually are your switches wired to ground?  If so they can share that wire with the analog...

Your other option is to buy an Arduino Micro which is the same but much smaller, then you'd need to solder the wires directly to it's pins.  If you'd asked before ordering the Leonardo that's what anyone here would have told you to do but you were too keen :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 23 November 2015, 10:56:57
Yeah, each switch connects to a pin 1-13 and ground.  Total wire account is based on 11 buttons and analog stick with 4 pinouts.

I may have gotten the wire account wrong by a little bit. Plus, I realize that I can couple together the grounds for the wires at the handset with solder and heat shrink tubing and then just have one cable for all of the grounds going to the board.  Not sure a 24gauge wire should carry the ground connection for all 11 buttons and the analog stick. I'll probably used to ground wires to divide it up.

yeah, maybe i should look closer at the Micro.  could make for some interesting design options due to its small size :cool:

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 26 November 2015, 00:24:12
Got a question. I see there are 0-5 analog input pins on board. Does that mean I can have a total of three analog sticks in theory?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 27 November 2015, 17:46:51
Just some minor work this evening. I decided to go with electrical tape to house the analog mod to conserve space.
[attach=1]
[attach=2]

I've sent a message to Finland asking for another mod. Hopefully he can find the time to do another one, but maybe not.

I've discovered that a second analog stick next to the one for camera control would be vastly superior for additional commands instead of the three cherry switches I planned to affix to the top.

Analog sticks offer 4 available commands instead of three cherry switches. And an analog stick takes up probably 10% of the space :cool:

Oh, and in case anybody is wondering, no need to be concerned about using analog sticks for digital commands.

using xpadder, or probably by using some kind of code in the Arduino sketch, the analog sticks can be configured to only activate a command when they reach a certain percentage of travel. In other words, xpadder allows you to configure the nullzone, or dead zone.  I found in the past that doing so resolves any issues with inadvertent commands due to imperfect movement UDL or R with an analog stick :thumb:

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 28 November 2015, 10:49:33
 i just realized that i can go with the easier and less expensive psp analog stick for the 2nd stick of the controller.

since the 2nd stick won't be used continuous throughout the game like the 1st stick for camera control, the 2nd stick doesn't need to be the absolute best available.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sat, 28 November 2015, 13:48:37
If you want to go with a smaller microcontroller, i recommend teensy 3.2 or LC. More everything in a smaller package and cheaper, than in micro.

http://pjrc.com/teensy/teensy31.html
http://pjrc.com/teensy/teensyLC.html

Those are what I use in all of my mods.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 28 November 2015, 14:10:49
is a teensy recognized out-of-the-box by pc as game controller and/or keyboard-mouse like the leonardo?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sat, 28 November 2015, 14:20:11
Yes, and it is done much better. It has native mouse + kb + joystick mode. No need to install anything extra except teensyduino.

Here is basic joystick usage: http://pjrc.com/teensy/td_joystick.html
That is a little outdated, but main features are there.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 30 November 2015, 11:40:52
1st step of cabling work is done.  not fun.  have ordered braided cable sleeve and heat shrink tube.

[attach=1]
[attach=2]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 30 November 2015, 15:26:58
Yes, and it is done much better. It has native mouse + kb + joystick mode. No need to install anything extra except teensyduino.

Here is basic joystick usage: http://pjrc.com/teensy/td_joystick.html
That is a little outdated, but main features are there.

thanks for letting me know.  is that your webstore at those links to teensy? 

teensy might be useful in future revisions.  for now, i'm going with what i know works to get myself back into league of legends as fast as possible.  thereafter, who knows what i might be able to do with this device :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 30 November 2015, 23:34:25
can teensy have 2 analog sticks?

can the same sketch be used in leonardo and teensy without changes?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 30 November 2015, 23:48:44
If you want to go with a smaller microcontroller, i recommend teensy 3.2 or LC. More everything in a smaller package and cheaper, than in micro.

http://pjrc.com/teensy/teensy31.html
http://pjrc.com/teensy/teensyLC.html

Those are what I use in all of my mods.

if i get a teensy, is it easier for you and/or other guys here to make a sketch for 8 buttons and 2 analog sticks?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 01 December 2015, 10:56:11
Hey guys, I decided I want to move in the direction of teensy implementation if possible. I at least want to do some testing to see if I can achieve the same results as the Leonardo.

If the teensy will work for this project, I can build the teensy board into the housing of the handset probably positioned on the outside panel of the outside leg of keys. I'm pretty sure this will make the project construction easier because I won't have to deal with a long run of cables that I've recently fashioned which runs between handset and the project box from my original design. Dealing with those cables involves braided wire sleeve, heat shrink tubing, and some manual labor that isn't very elegant or fun.  with a teensy, i could eliminate the project box altogether :cool:

I'd like to order a teensy to run it through the same tests that I did with the Leonardo, but at a minimum I need to get an answer to this question:

Can a teensy have two analog sticks and eight buttons?

If possible, can somebody try to get back to me today or sometime soon on just this question?

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Tue, 01 December 2015, 12:41:51
Teensy can manage up to 6 axis and 16 buttons (32 for the Teensy++)... https://www.pjrc.com/teensy/td_joystick.html
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 01 December 2015, 12:50:35
That is a lot of wires, do you not have a sister/gf to braid them prettily for you? :))  Going for a smaller controller sounds a good idea.

The Teensy 2.0 and Arduino Leonardo/Micro use the same chip, the main differences are the bootloader and size (Teensy < Micro < Leonardo) while the Teensy LC is completely different but claims 13 analog inputs (6 1/2 sticks) which would leave another 14 I/O pins for switches - that's plenty :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 01 December 2015, 16:58:01
got it thanks for answering guys ;D

i'll go ahead and get this one.  it's the same one finland linked in a post above

http://www.amazon.com/gp/product/B015M3K5NG/ref=s9_hps_bw_g328_i1

and yes, that mess of cables is definitely motivating this design change :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Thu, 03 December 2015, 03:47:14
Small controller are the way to go. It is impressive how much space the cables can eat away. Braiding is a good way to organize them. I did that on my trackball conversion project (used PCB holes to attache them too).

(http://i.imgur.com/PcboItP.jpg)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 03 December 2015, 17:06:36
right on, that's some good wiring there.

that's where i live now, wiring world.  did a 50% teardown and wired up one side.  you're right, wires eat up an unexpected amount of space.

[attach=1]
[attach=2]

 i want to redo this piece of work by joining all the black wires for ground together near to their origin and then just have one black wire running through the top.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 03 December 2015, 17:17:12
got psp 2000 analog stick.  what a piece of sh*t compared to the vita stick :-X

i even did the research to find out the psp 2000 stick is less of a piece of sh*t than the psp 1000 because the 2000 isn't as stiff.  but still, it's stiff.

anyway, it's fine for now.


same as before, does someone happen to know what the pinouts are for on this stick(1-4)?  need to know the power, ground, x and y.  i scoured the internet and couldn't find any mention of the pinouts.
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 03 December 2015, 22:22:15


same as before, does someone happen to know what the pinouts are for on this stick(1-4)?  need to know the power, ground, x and y.  i scoured the internet and couldn't find any mention of the pinouts.


took like an hour to find the answer

http://forums.modretro.com/viewtopic.php?f=36&t=11641

the psp 2000 pinout is different from the 1000
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 03 December 2015, 23:04:17
works :thumb:
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 04 December 2015, 02:51:55
Nice, looks like the hardware is nearly done - you should be back gaming by new year :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Fri, 04 December 2015, 03:49:55
I appreciate this kind of project as it is a it the opportunity to play to people with a single hand (or single usable hand).
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 04 December 2015, 07:52:49
Nice, looks like the hardware is nearly done - you should be back gaming by new year :)

yeah i think you're right.  the end is coming together a lot faster than the early stages ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 04 December 2015, 08:00:10
I appreciate this kind of project as it is a it the opportunity to play to people with a single hand (or single usable hand).

right, in my case the latter as i have got multiple RSI in lefty which is why this controller is for right hand.  lefty can't even mouse, and i'm using a Huion 420 pen tablet for mousing. 

if someone only has one hand, this controller could have a mouse integrated into the bottom and the user could slide it around on the desk in a way similar to those vertical oriented mouses.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sat, 05 December 2015, 07:05:47
The main differences between leonardo and teensy joystick code are a little different words used and analog stick range. On leonardo its from -127 to 128 and on teensy its from 0 to 1023.
Both are simple to change so no problems there.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 05 December 2015, 13:42:24
The main differences between leonardo and teensy joystick code are a little different words used and analog stick range. On leonardo its from -127 to 128 and on teensy its from 0 to 1023.
Both are simple to change so no problems there.

ok good news ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 05 December 2015, 13:58:03
lots of work the past few days.  probably 5 hours or so.  the progress isn't much because i had to do a lot of trial and error.

One cherry switch even died.

Rest in peace switch. Your sacrifice will be remembered.

Shouldn't underestimate the amount of work that goes into wiring. I had to do many redos that required teardown's until I got the wiring layout that I think will be optimal.

The handset has gotten really ugly in the process, but that can be handled later.

Also, before I really put in some work in on wire management, the thing looked like some kind of alien marine invertebrate life-form with some super nasty electric nerve poison :-X  No pics of that, because they would cause nightmares :))

Here is the first leg switches' grounds coupled together with one wire extending across the handset where it will be joined with another ground coupling of the analog sticks.  that coupling will finally go to a teensy ground pin.
[attach=1]

Here is the outside leg switches' grounds coupled together with one wire which will go to a teensy ground pin.
[attach=2]

Here is some rotary tool shaping work I did to get a level surface on which the second and possibly third analog sticks will go.
[attach=3]
[attach=4]
[attach=5]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 05 December 2015, 14:02:43
have started pestering finland guy for ps vita mods again.  psp stick is just so laughably inferior :rolleyes:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 11:27:38
have just now completed wireup of completed v1 device.  all connections are verified working via testing /w leonardo board.

cosmetics are not a consideration at all yet.  i've just been tearing chunks of clay from source and pasting them onto the device to get things nailed down with no smoothing or other beautification work done at all. 

here you can see

all connections are functional and are ready to be trimmed and stripped for appropriate distancing adjustments needed to solder to teensy. this is the backside of the outside leg in 1st pic

[attach=1]

view from back of the device
[attach=2]

view from front of the device

[attach=3]

an action shot to show normal use /w thumb on primary analog (camera control in league along with pings via alt-keymap).
[attach=4]

an action shot of thumb using 2nd analog stick (summoner spells and other such commands).
[attach=5]

an action shot of thumb in position where 3rd analog stick will be in v2 of the device (hoping for more ps vita stick mods from finland).  this stick will be for less frequently used commands because we don't want too many commands used in a way such that thumb is brought very far from neutral/at-rest position so we can avoid RSIs.

[attach=6]

teensy arrives wednesday.  any chance someone can put together the all-important sketch sometime soon?  i would of course be grateful :D

sketch needed is for
8 switches
2 analog sticks
1 analog stick as a digital input (activation upon stick moved 25% from nullzone)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 06 December 2015, 15:28:02
I've made progress, but what do you want the second analog to be controlling?  I can only see X Y and Z axis, plus X Y and Z rotation axis.

Do both the other analogs need to be digitized?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: sinusoid on Sun, 06 December 2015, 15:51:24
Do you find the buttons comfortable to press?

I always had this issue with such handheld designs, that because the fingers essentially rested on the switches all the time, there were problems with grabbing it firmly, and it tended to change position inside of my hand with use. Had to be adjusted often as a result.

Always tried to get such designs strapped to the hand because of that.

('such designs' were mostly keyers in my case, I did a few prototypes).
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 06 December 2015, 16:03:39
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...

Code: [Select]
#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};
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() {
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2)
  if (Temp < -30) {
    if buttonState[8] = 0{
      buttonState[8] = 1
    }
  else
    if buttonState[8] = 1{
      buttonState[8] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[9] = 0{
      buttonState[9] = 1
    }
  else
    if buttonState[9] = 1{
      buttonState[9] = 0
    }
  }

  Temp = analogRead(3)
  if (Temp < -30) {
    if buttonState[10] = 0{
      buttonState[10] = 1
    }
  else
    if buttonState[10] = 1{
      buttonState[10] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[11] = 0{
      buttonState[11] = 1
    }
  else
    if buttonState[11] = 1{
      buttonState[11] = 0
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if buttonState[12] = 0{
      buttonState[12] = 1
    }
  else
    if buttonState[12] = 1{
      buttonState[12] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[13] = 0{
      buttonState[13] = 1
    }
  else
    if buttonState[13] = 1{
      buttonState[13] = 0
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if buttonState[14] = 0{
      buttonState[14] = 1
    }
  else
    if buttonState[14] = 1{
      buttonState[14] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[15] = 0{
      buttonState[15] = 1
    }
  else
    if buttonState[15] = 1{
      buttonState[15] = 0
    }
  }
 
Joystick.sendState()
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 16:19:11
I've made progress, but what do you want the second analog to be controlling?  I can only see X Y and Z axis, plus X Y and Z rotation axis.

Do both the other analogs need to be digitized?

i'm not completely sure i understand your question, but i think i got it. 

this build only has 2 analogs, but i'm hoping to have 3 in the end.

1st two analogs should just be programmed as analog.  X Axis/Y Axis  for one and for the other one...

probably Z Axis and X Rotation.  that's my best guess as to what xpadder will see as a "2nd analog stick" rather than an analog trigger. 

I tried to answer this question by connecting my x360 controller to see what shows up as present in this kind of screenshot, but the controller won't connect to my pc right now for unknown reason.

[attach=1]

3rd stick is the one that needs to be digital because xpadder only sees maximum 2 analog sticks. 

let me know if i didn't answer what you're looking for
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 16:20:52
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...



great thank you much i'll give it a try  :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 16:27:39
Do you find the buttons comfortable to press?

I always had this issue with such handheld designs, that because the fingers essentially rested on the switches all the time, there were problems with grabbing it firmly, and it tended to change position inside of my hand with use. Had to be adjusted often as a result.

Always tried to get such designs strapped to the hand because of that.

('such designs' were mostly keyers in my case, I did a few prototypes).

extremely comfortable.  goal is to make it so comfortable i can't feel anything there.  probably achieved some percentage of that.  pulling keys is more comfortable than depressing them with extended finger - no doubt from my keypressing tests.

the device wiggles a little bit in use.  with the weight of the clay and friction of it resting on lap, the wiggle doesn't appear to affect usability.  but, a base or the handrest i once thought of, like your straps may be helpful.  straps i will avoid rigorously though 'cause i don't want to be locked in like that.

while it wiggles, i'm not seeing an out-of-position problem.  it can be dislodged when used exaggeratedly, but not otherwise as i can see in tests.

only true game testing will tell about true usability.  but from what i can see, it will work very well.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 17:34:25
Made a short video showing a range of actions from what's probably normal gaming intensity all the way up to button mashing.

feature=youtu.be

The device seems to work well enough. It would be nice to have a base which would completely eliminate any wiggling. But any additional physical appendages are a lot of work. Before I set about doing so much work to eliminate the wiggling which appears to be a non-issue, I plan to do some real gaming tests with the hope that no further major design work is necessary ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: trenzafeeds on Sun, 06 December 2015, 18:05:22
This is very cool, really nice work so far. I love to see people using the keyboard-building knowledge from the community to build non-keyboard things, awesome project.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 18:10:04

('such designs' were mostly keyers in my case, I did a few prototypes).

forgot to ask, what's a keyer?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 18:15:58
This is very cool, really nice work so far. I love to see people using the keyboard-building knowledge from the community to build non-keyboard things, awesome project.

glad you like it. i'm certainly grateful for this community.  what surprises me is how this community's work differs so much from mass consumption commercial products.  maybe that won't be such a difference in a few more years when more people realize how much time they spend at pc and therefore how important the quality of tools are. 
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 December 2015, 22:51:06
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...


Unfortunately, this doesn't compile in Arduino IDE

This is the error message I got

Code: [Select]
Arduino: 1.6.5 (Windows 7), Board: "Arduino Leonardo"

sketch_dec06a.ino: In function 'void loop()':
sketch_dec06a:47: error: expected ';' before 'if'
sketch_dec06a:131: error: expected '}' at end of input
sketch_dec06a:131: error: expected '}' at end of input
expected ';' before 'if'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Maybe it only works on the teensy after I install teensyduino?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: trenzafeeds on Mon, 07 December 2015, 00:54:05
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...


Unfortunately, this doesn't compile in Arduino IDE

This is the error message I got

Code: [Select]
Arduino: 1.6.5 (Windows 7), Board: "Arduino Leonardo"

sketch_dec06a.ino: In function 'void loop()':
sketch_dec06a:47: error: expected ';' before 'if'
sketch_dec06a:131: error: expected '}' at end of input
sketch_dec06a:131: error: expected '}' at end of input
expected ';' before 'if'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Maybe it only works on the teensy after I install teensyduino?

I could be wrong, but those just look like formatting errors, not actual problems with the code like variables not existing or something.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Mon, 07 December 2015, 01:20:45
For the errors, just add a ; at the end of all Temp = analogRead(some pin number) lines.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: sinusoid on Mon, 07 December 2015, 12:08:11
forgot to ask, what's a keyer?

https://en.wikipedia.org/wiki/Keyer

Essentially, it's what you just made, but used for typing  ;D

glad you like it. i'm certainly grateful for this community.  what surprises me is how this community's work differs so much from mass consumption commercial products.  maybe that won't be such a difference in a few more years when more people realize how much time they spend at pc and therefore how important the quality of tools are. 

Manufacturing tools are easy to access nowadays, and individuals can make products far surpassing mass-production when it comes to technological processes, customization, finish, quality... there are plenty of examples on this forum and elsewhere on the internets.

This market is not very attractive to corporations (yet), because the products that are being sold have relatively high cost, carry a high manufacturing risk and overhead, often need R&D on case-by-case basis... these are a hell to make from a corporate POV. And the market is very small.

This may change with advancements in design automation, 3d printing, 3d scanning, and - primarily - increasing demand. But not very likely to happen in the nearest decade.

Example: if you made a small run of your keyboard for the interested people, it would be more profitable for you to use either hi-grade epoxy resin for casting it, making it very durable (you could hammer nails with it without chipping) or biocompatible or neutral silicone (Sugru is essentially that AFAIK - neutral condensation silicone with a filler, probably talcum).
Both of these are extremely expensive compared to ABS for instance, but you'll save a lot of money, time, risk and effort compared to having a small injection molding run.

But yeah... it's nice to see people whose imaginations are not limited by store-shelf availability.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 07 December 2015, 13:04:50
I could be wrong, but those just look like formatting errors, not actual problems with the code like variables not existing or something.

Haha, yeah... Looks like I slipped back into my day job and started writing VB :-[

Should also have pointed out that this code was lazy and assumed you were using digital pins 0-7, if you want to use different ones you need to update myPins at the top.

Does this work?  I really should install Arduino on here so I can test it myself :))

Code: [Select]
#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};
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() {
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2)
  if (Temp < -30) {
    if (buttonState[8] == 0){
      buttonState[8] = 1;
    }
  else
    if (buttonState[8] == 1){
      buttonState[8] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[9] == 0){
      buttonState[9] = 1;
    }
  else
    if (buttonState[9] == 1){
      buttonState[9] = 0;
    }
  }

  Temp = analogRead(3)
  if (Temp < -30) {
    if (buttonState[10] == 0){
      buttonState[10] = 1;
    }
  else
    if (buttonState[10] == 1){
      buttonState[10] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[11] == 0){
      buttonState[11] = 1;
    }
  else
    if (buttonState[11] == 1){
      buttonState[11] = 0;
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if (buttonState[12] == 0){
      buttonState[12] = 1;
    }
  else
    if (buttonState[12] == 1){
      buttonState[12] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[13] == 0){
      buttonState[13] = 1;
    }
  else
    if (buttonState[13] == 1){
      buttonState[13] = 0;
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if (buttonState[14] == 0){
      buttonState[14] = 1;
    }
  else
    if (buttonState[14] == 1){
      buttonState[14] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[15] == 0){
      buttonState[15] = 1;
    }
  else
    if (buttonState[15] == 1){
      buttonState[15] = 0;
    }
  }
 
Joystick.sendState()
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Mon, 07 December 2015, 14:34:31
Does this work?  I really should install Arduino on here so I can test it myself :))

Do not have Arduino IDE installed as I'm moving to C code with avr-gcc, but I can still see missing ";". Too lazy to install the IDE, sorry  :p
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 07 December 2015, 14:48:54
Does this work?  I really should install Arduino on here so I can test it myself :))

Do not have Arduino IDE installed as I'm moving to C code with avr-gcc, but I can still see missing ";". Too lazy to install the IDE, sorry  :p

Damnit, such a stupid syntax - why oh why can't a newline just be a newline?  It's much more likely than the other way round.

I can't see it but will give Camineet something to fix now that the if's at least work :P
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 07 December 2015, 14:51:53
Does this work?  I really should install Arduino on here so I can test it myself :))


nope, still getting same error as before.  i'll see if i can fix it according to what was suggested above when freetime comes :)

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 08 December 2015, 16:31:23
got it to compile. i'll work on testing soon :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 08 December 2015, 16:36:53
Great!  I just hope it works...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 08 December 2015, 17:30:42
Here is the report. Buttons zero through seven work.

Analog pins A0 and A1 work well controlling X Axis / Y Axis here:

[attach=3]

no perceptible lag.  maybe some but it would be less than i can easily see without something to compare immediately like a/b testing.

Analog on other pin combinations, such as A2-A3, and A4-A5, result in X Axis / Y Axis control. But the control is only in a diagonal from lower left to upper right as follows:

[attach=1]

I think what I need is A2 and A3 pins to control these guys right here:

[attach=2]
I think this will be important because if the analogs are controlling the same thing, I'm sure it will be a problem for Xpadder to recognize them as different sticks.

And then I need pins A4 and A5 to be 4 buttons.

Here's the code that I got uploaded and working:

Code: [Select]
#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};
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() {
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2);
  if (Temp < -30) {
    if (buttonState[8] == 0){
      buttonState[8] = 1;
    }
  else
    if (buttonState[8] == 1){
      buttonState[8] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[9] == 0){
      buttonState[9] = 1;
    }
  else
    if (buttonState[9] == 1){
      buttonState[9] = 0;
    }
  }

  Temp = analogRead(3);
  if (Temp < -30) {
    if (buttonState[10] == 0){
      buttonState[10] = 1;
    }
  else
    if (buttonState[10] == 1){
      buttonState[10] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[11] == 0){
      buttonState[11] = 1;
    }
  else
    if (buttonState[11] == 1){
      buttonState[11] = 0;
    }
  }
 
  Temp = analogRead(4);
  if (Temp < -30) {
    if (buttonState[12] == 0){
      buttonState[12] = 1;
    }
  else
    if (buttonState[12] == 1){
      buttonState[12] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[13] == 0){
      buttonState[13] = 1;
    }
  else
    if (buttonState[13] == 1){
      buttonState[13] = 0;
    }
  }
 
  Temp = analogRead(4);
  if (Temp < -30) {
    if (buttonState[14] == 0){
      buttonState[14] = 1;
    }
  else
    if (buttonState[14] == 1){
      buttonState[14] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[15] == 0){
      buttonState[15] = 1;
    }
  else
    if (buttonState[15] == 1){
      buttonState[15] = 0;
    }
  }
 
Joystick.sendState()
;}}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 08 December 2015, 18:07:23
Well that's strange.  As you can see in the second part of the code (after all the comments) A2-5 get read into Temp then  depending if that value is < -30 or > 30 it should press buttons 8-15 - the analog should not move at all.  A diagonal movement suggests you have a short as the power rises and falls on both axis at the same time, but that should happen whichever pair of pins you use and 0 and 1 work fine?  Can you try using pins A2 and A4?

I just had another look at the code and simplified it for the non-analog analogs (the rotation axis take values from 0-360 degrees rather than higher or lower than 0 so I don't think they'll work) and noticed that pin 4 was read twice and 5 not at all, but other than that this code won't fix anything.  Should run quicker though, though sounds like you won't notice! Edit: added lines to set analogs as input, just in case...

Code: [Select]
#define STICK_X 0
#define STICK_Y 1
#define OVERVAL 0

int Xstick;
int Ystick;
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
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() {
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2);
  if (Temp < -30) {
      buttonState[8] = 1;
    }
  else {
      buttonState[8] = 0;
  }

  if (Temp > 30) {
      buttonState[9] = 1;
    }
  else {
      buttonState[9] = 0;
  }

  Temp = analogRead(3);
  if (Temp < -30) {
      buttonState[10] = 1;
    }
  else {
      buttonState[10] = 0;
  }

  if (Temp > 30) {
      buttonState[11] = 1;
    }
  else {
      buttonState[11] = 0;
  }
 
  Temp = analogRead(4);
  if (Temp < -30) {
      buttonState[12] = 1;
    }
  else {
      buttonState[12] = 0;
  }

  if (Temp > 30) {
      buttonState[13] = 1;
    }
  else {
      buttonState[13] = 0;
  }
 
  Temp = analogRead(5);
  if (Temp < -30) {
      buttonState[14] = 1;
    }
  else {
      buttonState[14] = 0;
  }

  if (Temp > 30) {
      buttonState[15] = 1;
    }
  else {
      buttonState[15] = 0;
  }
 
Joystick.sendState()
}}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 08 December 2015, 18:34:52
strange but i get the exact same results :-X   :))

i think i found a problem...

this code here only allows each analog stick to control 2 buttons instead of 4?  is that correct?

Code: [Select]
Temp = analogRead(2);
  if (Temp < -30) {
      buttonState[8] = 1;
    }
  else {
      buttonState[8] = 0;
  }

  if (Temp > 30) {
      buttonState[9] = 1;
    }
  else {
      buttonState[9] = 0;
  }

  Temp = analogRead(3);
  if (Temp < -30) {
      buttonState[10] = 1;
    }
  else {
      buttonState[10] = 0;
  }

  if (Temp > 30) {
      buttonState[11] = 1;
    }
  else {
      buttonState[11] = 0;
  }
 
  Temp = analogRead(4);
  if (Temp < -30) {
      buttonState[12] = 1;
    }
  else {
      buttonState[12] = 0;
  }

  if (Temp > 30) {
      buttonState[13] = 1;
    }
  else {
      buttonState[13] = 0;
  }
 
  Temp = analogRead(5);
  if (Temp < -30) {
      buttonState[14] = 1;
    }
  else {
      buttonState[14] = 0;
  }

  if (Temp > 30) {
      buttonState[15] = 1;
    }
  else {
      buttonState[15] = 0;
  }

this would perhaps explain why the stick is only moving in the diagonal line previously described.


i think the code for each stick needs to be twice as big, something like..

Code: [Select]
Temp = analogRead(5);
  if (Temp < -30) {
      buttonState[14] = 1;
    }
  else {
      buttonState[14] = 0;
  }
// a piece of code that says if Temp is between something and something, button 15 should be activated
  if (Temp > 30) {
      buttonState[16] = 1;
    }
  else {
      buttonState[16] = 0;
// a piece of code that says if Temp is between something and something, button 17 should be activated
  }


Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 08 December 2015, 18:53:28
It shouldn't be doing analog at all though, just buttons :confused:

Each stick is read one axis at a time and there are two switches per axis so the code says if you press down on pin 2 (< -30) press button 8 or if you press up (> 30) press button 9 - anything between -30 and 30 registers as nothing.  Then it checks left/right with a button for each.

This seems sound, but maybe you're supposed to analogRead(A2) etc instead of just (2)?  I'd hope it would error but maybe not.

Also did you add the bit below in?  I think it should be in setup rather than at the top where I put it

pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 08 December 2015, 19:53:45
Looks like I made a mistake before and didn't use the newest code you posted at all. I don't know how that happened because I and  copy and pasted it....

anyway, i just now uploaded this code, and still got the exact same result:

Code: [Select]
#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};
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() {

pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);

  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2);
  if (Temp < -30) {
      buttonState[8] = 1;
    }
  else {
      buttonState[8] = 0;
  }

  if (Temp > 30) {
      buttonState[9] = 1;
    }
  else {
      buttonState[9] = 0;
  }

  Temp = analogRead(3);
  if (Temp < -30) {
      buttonState[10] = 1;
    }
  else {
      buttonState[10] = 0;
  }

  if (Temp > 30) {
      buttonState[11] = 1;
    }
  else {
      buttonState[11] = 0;
  }
 
  Temp = analogRead(4);
  if (Temp < -30) {
      buttonState[12] = 1;
    }
  else {
      buttonState[12] = 0;
  }

  if (Temp > 30) {
      buttonState[13] = 1;
    }
  else {
      buttonState[13] = 0;
  }
 
  Temp = analogRead(5);
  if (Temp < -30) {
      buttonState[14] = 1;
    }
  else {
      buttonState[14] = 0;
  }

  if (Temp > 30) {
      buttonState[15] = 1;
    }
  else {
      buttonState[15] = 0;
  }
 
Joystick.sendState()
;}}

no button action at all on 2nd and 3rd analog stick connections on A2-A3 or A4-A5.  just the diagonal analog movement in x axis / y axis

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 08 December 2015, 20:33:28
It shouldn't be doing analog at all though, just buttons :confused:

And yeah, it shouldn't be doing any analog stuff at all on those other pins :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 08 December 2015, 20:37:16
Maybe this bit of code isn't getting seen.
Code: [Select]
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);

Have I got it in the wrong spot here?

Code: [Select]
#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};
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() {

pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);

  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2);
  if (Temp < -30) {
      buttonState[8] = 1;
    }
  else {
      buttonState[8] = 0;
  }

  if (Temp > 30) {
      buttonState[9] = 1;
    }
  else {
      buttonState[9] = 0;
  }

  Temp = analogRead(3);
  if (Temp < -30) {
      buttonState[10] = 1;
    }
  else {
      buttonState[10] = 0;
  }

  if (Temp > 30) {
      buttonState[11] = 1;
    }
  else {
      buttonState[11] = 0;
  }
 
  Temp = analogRead(4);
  if (Temp < -30) {
      buttonState[12] = 1;
    }
  else {
      buttonState[12] = 0;
  }

  if (Temp > 30) {
      buttonState[13] = 1;
    }
  else {
      buttonState[13] = 0;
  }
 
  Temp = analogRead(5);
  if (Temp < -30) {
      buttonState[14] = 1;
    }
  else {
      buttonState[14] = 0;
  }

  if (Temp > 30) {
      buttonState[15] = 1;
    }
  else {
      buttonState[15] = 0;
  }
 
Joystick.sendState()
;}}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 09 December 2015, 02:29:24
Is this the Arduino which wont do serial.print or was that someone else?  Printing out the analog values would be helpful...

You need to experiment a bit - change STICK_X and Y at the top to the other pins and comment/delete the second section and 4 new lines (they are in the right place, you probably missed them because I edited the post after you read it - not quick enough :))) to see if the pins are working correctly.  If they are I'm stumped and will be waiting for W11cE to tell me what I've missed.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Wed, 09 December 2015, 02:47:59
I have no analog stick at home but I can take a deeper look into the code if you want.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 09 December 2015, 03:02:40
I have no analog stick at home but I can take a deeper look into the code if you want.

Please do - it's pretty simple and I've outlined above what it's supposed to do but not only is it not pressing the buttons as requested it's moving the analog, and not even doing that well.  Either I've missed something major or there's a hardware issue, but with nothing here to "poke and see what happens" it's hard to tell which!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Wed, 09 December 2015, 13:59:22
I have no analog stick at home but I can take a deeper look into the code if you want.

Please do - it's pretty simple and I've outlined above what it's supposed to do but not only is it not pressing the buttons as requested it's moving the analog, and not even doing that well.  Either I've missed something major or there's a hardware issue, but with nothing here to "poke and see what happens" it's hard to tell which!

I can't test with the hardware, but here's the revised code. I used the full pin name for analog pins and deleted their pinmode() as it seems to be the way to do (only worked with digital pins on my Arduino codes). I also reduced your code size by using ternary operator for simple IF THEN ELSE structures.

Note: I can't test compilation with Joystick functions on Archlinux as I'm limited to IDE 1.6.5 (need 1.6.6 for Joystick lib it seems).

Code: [Select]
#define STICK_X A0
#define STICK_Y A1
#define OVERVAL 0

int Xstick;
int Ystick;

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);
  }
 
  Joystick.begin(false);
}

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

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 127, -127);
  Ystick = constrain(Ystick, -127, 127);
  Joystick.setYAxis(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
    {
      if(buttonState[i] == LOW)     // button has been pressed
      {
        Joystick.pressButton(i);    // press corresponding "joystick" button
      }
      else                          // button has been released
      {
        Joystick.releaseButton(i);  // release corresponding "joystick" button
      }
      oState[i] = buttonState[i];   // save state to compare next time
    }

    Temp = analogRead(A2);
    (Temp < -30) ? buttonState[8] = 1 : buttonState[8] = 0;
    (Temp >  30) ? buttonState[9] = 1 : buttonState[9] = 0;
   
    Temp = analogRead(A3);
    (Temp < -30) ? buttonState[10] = 1 : buttonState[10] = 0;
    (Temp >  30) ? buttonState[11] = 1 : buttonState[11] = 0;
 
    Temp = analogRead(A4);
    (Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
    (Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;
 
    Temp = analogRead(A5);
    (Temp < -30) ? buttonState[14] = 1 : buttonState[14] = 0;
    (Temp >  30) ? buttonState[15] = 1 : buttonState[15] = 0;
 
    // Update joystick state
    Joystick.sendState();
  }
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 09 December 2015, 14:23:35
ty guys working hard day - hope to be able to work together with you on this tonight or soon otherwise ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 09 December 2015, 15:21:29
here is the report.  most recent code above produces exact same results :-\

teensy will allow for better troubleshooting.

yes, this is the leonardo that doesn't output anything to serial monitor.  tried again just now.  opened serial monitor and moved analog stick on working pins and on non-working pins.  no output whatsoever to serial monitor.

for further troubleshooting, i removed the proto-shield and connected to board directly with these results which haven't changed:

works
[attach=1]

doesn't work
[attach=2]

doesn't work
[attach=3]


i had a thought.  maybe the 2nd analog stick only works if the 1st analog stick remains connected.  i haven't tried connecting both existing sticks yet. 
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 09 December 2015, 15:37:51
Well you're doing better than me - I downloaded a fresh copy of 1.6.6, swapped the files and added the library but on compiling it says this mess :))

Code: [Select]
Arduino: 1.6.6 (Windows 7), Board: "Arduino Leonardo"

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\USBAPI.h:38:0,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp:19:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp:54:71: error: 'USB_EP_SIZE' was not declared in this scope

  D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,USB_EP_SIZE,0),

                                                                       ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\USBCore.h:272:22: note: in definition of macro 'D_ENDPOINT'

  { 7, 5, _addr,_attr,_packetSize, _interval }

                      ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp:55:71: error: 'USB_EP_SIZE' was not declared in this scope

  D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,USB_EP_SIZE,0)

                                                                       ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\USBCore.h:272:22: note: in definition of macro 'D_ENDPOINT'

  { 7, 5, _addr,_attr,_packetSize, _interval }

                      ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp:64:16: error: 'bool CDC_Setup' redeclared as different kind of symbol

 bool CDC_Setup(USBSetup& setup)

                ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp:19:0:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\USBAPI.h:269:6: error: previous declaration of 'bool CDC_Setup(Setup&)'

 bool CDC_Setup(Setup& setup);

      ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp:64:16: error: 'USBSetup' was not declared in this scope

 bool CDC_Setup(USBSetup& setup)

                ^

exit status 1
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.



Not surprising you're getting the same results as the code is the same just much tidier (thanks GuilleAcousitc - I'll remember that structure!)

There's no reason that having two analogs connected would change anything but to confirm you can try swapping STICK_X and STICK_Y to different pins at the top to see whether it's the pins or the stick - comment out the stick-buttons bit at the bottom so it doesn't interfere.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 09 December 2015, 15:48:03
i had a thought.  maybe the 2nd analog stick only works if the 1st analog stick remains connected.  i haven't tried connecting both existing sticks yet.

yeah this was a longshot and didn't work. 1st analog works as usual.  2nd analog stick doesn't do anything when added.  no diagonal-only analog movement as before.  and no buttons.  just no output at all.

i've tried all kinds of combos.  i've even tried connecting analog 2 to pins A2-A4 instead of A2-A3 as they should be.  just trying anything and everything.

anyway, teensy will allow for more certainty about the problem when it arrives ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Thu, 10 December 2015, 02:27:19
Not surprising you're getting the same results as the code is the same just much tidier (thanks GuilleAcousitc - I'll remember that structure!)

It is not exactly the same as I changed the analog pin label from 0, 1, 2, 3, 4, 5 to A0, A1, A2, A3, A4 and A5. Sadly I have no analog source to test the code. Or I could wire my arcade stick parts to analog inputs and read either 0V or 5V .... Also I have no Arduino Leonardo at home. Only spare board is an Arduino Mega2560. Arduino micro is used inside my trackball and the Teensy++ 2.0 is used inside my keyboard.

Maybe you could try this library (especially the Joystick3 version): https://github.com/MHeironimus/ArduinoJoystickLibrary

Regarding the serial output, could you send me the code ?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 10 December 2015, 17:58:27

Regarding the serial output, could you send me the code ?

aah sorry but i don't understand your question.  if that question is for me, can you please tell me some more details?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 10 December 2015, 17:59:00
teensy arrived. installing...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 10 December 2015, 18:35:53
hey guys i installed teensyduino and teensy 3.2 board no problem.  tried to just verify this code and got the error message below.  what's this about?  i remember when i got the leonardo set up for joystick use, i had to add some files to my arduino IDE install folder.  did perhaps installing teensyduino botch those up?

Code: [Select]
#define STICK_X A0
#define STICK_Y A1
#define OVERVAL 0

int Xstick;
int Ystick;

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);
  }
 
  Joystick.begin(false);
}

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

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 127, -127);
  Ystick = constrain(Ystick, -127, 127);
  Joystick.setYAxis(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
    {
      if(buttonState[i] == LOW)     // button has been pressed
      {
        Joystick.pressButton(i);    // press corresponding "joystick" button
      }
      else                          // button has been released
      {
        Joystick.releaseButton(i);  // release corresponding "joystick" button
      }
      oState[i] = buttonState[i];   // save state to compare next time
    }

    Temp = analogRead(A2);
    (Temp < -30) ? buttonState[8] = 1 : buttonState[8] = 0;
    (Temp >  30) ? buttonState[9] = 1 : buttonState[9] = 0;
   
    Temp = analogRead(A3);
    (Temp < -30) ? buttonState[10] = 1 : buttonState[10] = 0;
    (Temp >  30) ? buttonState[11] = 1 : buttonState[11] = 0;
 
    Temp = analogRead(A4);
    (Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
    (Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;
 
    Temp = analogRead(A5);
    (Temp < -30) ? buttonState[14] = 1 : buttonState[14] = 0;
    (Temp >  30) ? buttonState[15] = 1 : buttonState[15] = 0;
 
    // Update joystick state
    Joystick.sendState();
  }
}


Code: [Select]
Arduino: 1.6.5 (Windows 7), TD: 1.26, Board: "Teensy 3.2 / 3.1, Serial + Keyboard + Mouse + Joystick, 96 MHz optimized (overclock), US English"

Build options changed, rebuilding all

sketch_dec09a.ino: In function 'void setup()':
sketch_dec09a:20: error: no matching function for call to 'usb_joystick_class::begin(bool)'
sketch_dec09a.ino:20:23: note: candidate is:
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:28:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:1,
from sketch_dec09a.ino:5:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/usb_joystick.h:55:14: note: void usb_joystick_class::begin()
void begin(void) { }
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/usb_joystick.h:55:14: note:   candidate expects 0 arguments, 1 provided
sketch_dec09a.ino: In function 'void loop()':
sketch_dec09a:28: error: 'class usb_joystick_class' has no member named 'setXAxis'
sketch_dec09a:33: error: 'class usb_joystick_class' has no member named 'setYAxis'
sketch_dec09a:43: error: 'class usb_joystick_class' has no member named 'pressButton'
sketch_dec09a:47: error: 'class usb_joystick_class' has no member named 'releaseButton'
sketch_dec09a:69: error: 'class usb_joystick_class' has no member named 'sendState'
'class usb_joystick_class' has no member named 'sendState'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Thu, 10 December 2015, 19:28:36
From reading this (https://www.pjrc.com/teensy/td_joystick.html) there are quite a few differences between the code for a Teensy and a standard Arduino, it's similar enough that you should be able to substitute the button parts but the real analog might need some work.

Have a look at the sample code and try to map it to your pins, if you can get the buttons and the real analog working it should be easy enough to add the digitized analogs (assuming it was your Leonardo doing strange things not the sticks...)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 10 December 2015, 23:08:15
damn, not having any luck with basic teensy setup.  i think the one i got may even be defective.

tried on 2 Win7 machines

followed install instructions here

https://www.pjrc.com/teensy/td_download.html

then followed these instructions for joystick setup and uploading the Complete example sketch

https://www.pjrc.com/teensy/td_joystick.html

and this is the mess that shows up in controller properties


not sure if you can see, button 14 shows as pressed. nothing is connected.  no buttons or anything. 




anyway
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 10 December 2015, 23:16:32
sent message to seller to see if he or she thinks the board is defective based on post info above.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 10 December 2015, 23:20:16
in MUCH better news, finland guy is going to make 2 more vita mods for us ;D

it might take a while. but without those, this project won't be even near to its potential :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 11 December 2015, 02:55:19
That's random, if the seller says it's all good I'll replicate it tonight - might just be floating inputs (because you've got nothing connected) but will need to look at the code to see why 14 is different!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Fri, 11 December 2015, 03:39:19
Maybe you should just force the unconnected buttons to "released" inside your setup() function. That's too bad that you can't specify the exact number of axis and buttons unless you go real C++ and makes your own HID descriptor.

Haven't tried it, but there's maybe a way to change the HID descriptor on the lib side ... maybe. Also, from the link you provided, this forum thread could interest you: https://forum.pjrc.com/threads/23681-Many-axis-joystick
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 11 December 2015, 10:10:18
seller concurs that unconnected pins will appear as floating.  still doesn't explain button 14, but maybe it doesn't matter.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 11 December 2015, 10:11:55
i'll have to do some work to see if i can get something to work on this board.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 11 December 2015, 12:36:36
So I'm on Linux now, downloaded Arduino and installed Teensyduino but it does not like "Joystick" and refuses to compile the sample code.  Handy.

Looking at the code there is nothing special for pin 14 so that leaves it's location on the Teensy to be the problem and the only pin numbering I can find says it's pin 15 that has the LED so I'd expect that one to be your problem but no!  You only have 8 switches anyway, so just change numButtons at the top and you should be good.  Does the serial monitor work with the Teensy?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 11 December 2015, 12:47:09
Yeah, I plan to do these kinds of troubleshooting activities.

For the teensy, I plan to reduce the Complete sketch down to just one button and one analog stick for testing.

For the Leonardo and the sketch we've been trying to get to work with three analog sticks, I'm thinking that I will reduce that code down to just one analog stick set to connect with pins A2-A3 to see if those pins happen to be defective.

Of course the serial monitor doesn't work with the teensy :'( and I tried it on two different PCs.  The Complete sketch doesn't mention baud rate, so I don't know which baud rate to select in the serial monitor. If we can figure out which baud rate I should select, and the serial monitor still doesn't work for the teensy on two different PCs, I think were probably looking at user error as I couldn't get the Leonardo serial monitor to work on two different PCs either :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 11 December 2015, 12:58:32
Have you tried running the Arduino program as administrator?  Perhaps you don't have permission to access serial ports.  Also have you set the USB type under tools?  Don't think that was there with an Arduino but it is for Teensy, having changed that the code compiled!  Then I had to select a port (also under tools) so check that looks right.  I can't believe you have two defective boards, that would be so unlucky!

With everything working and 32 buttons selected I get no serial output suggesting stuff's happening after the initialisation stuff, but I'm on a 2.0++ not a 3.x so who knows if it's even comparable...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 11 December 2015, 13:16:42
Have you tried running the Arduino program as administrator?  Perhaps you don't have permission to access serial ports.  Also have you set the USB type under tools?  Don't think that was there with an Arduino but it is for Teensy, having changed that the code compiled!  Then I had to select a port (also under tools) so check that looks right.  I can't believe you have two defective boards, that would be so unlucky!

Haven't tried running as administrator yet. I'll give that a try in a little while.

Yeah, for teensy I selected USB type. If I don't, no game controller shows up at all.

But there was still some ugliness in getting the teensy to show up as a game controller. That went as follows:

On PC one, selecting serial keyboard mouse joystick resulted in the same text showing up in Win7 game controllers.  But it did not say teensy serial keyboard mouse joystick like it does in the instructions here:
https://www.pjrc.com/teensy/td_joystick.html

Also, selecting USB type keyboard mouse joystick without serial resulted in the properties page of the controller showing up blank.  and the name of the controller is just  keyboard mouse joystick - no mention of teensy in the name.

on PC2, both USB types work and show the game controller properties page with the hysteria (which is probably explained by floating), but there is still no mention of teensy in the game controller name, which may not be problematic.

Either way, I hope serial keyboard mouse joystick can be used, because that's the only one that works at all on PC1, which is my primary work and gaming station.

oh wait, it wasn't that serial monitor didn't work on teensy on 2 PCs, it's that when i tried running it, i got this error message and intended to ask you guys about it at some point...

Code: [Select]
Arduino: 1.6.5 (Windows 7), TD: 1.26, Board: "Teensy 3.2 / 3.1, Serial + Keyboard + Mouse + Joystick, 96 MHz optimized (overclock), US English"

Sketch uses 18,664 bytes (7%) of program storage space. Maximum is 262,144 bytes.

Global variables use 6,480 bytes (9%) of dynamic memory, leaving 59,056 bytes for local variables. Maximum is 65,536 bytes.

Teensy did not respond to a USB-based request to automatically reboot.

Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.

no serial port name defined

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Fri, 11 December 2015, 14:33:09
Prolly a dumb question, but did you plug the Teensy to a Usb2 or a Usb3 ?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 11 December 2015, 14:48:14
USB 3.0 on PC1

USB 2.0 on PC2

could explain the properties blank i got on PC1 when choosing keyboard/mouse/joystick without serial
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Fri, 11 December 2015, 15:54:09
USB 3.0 on PC1

USB 2.0 on PC2

could explain the properties blank i got on PC1 when choosing keyboard/mouse/joystick without serial

I've read here and there people havibg issues with peripherals on Usb3...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 11 December 2015, 16:51:35
"no serial port name defined" is what I get when there's nothing set in tools -> port.  There's only one entry in the list so you'd think it would default to that but it doesn't.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 13 December 2015, 00:35:09
Found a problem with teensy i can’t overcome and i’m not hopeful about it.  Xpadder can’t see analog input from teensy on USB 2.0 or 3.0.  i tried testing USB 2.0 on 2 different PCs.

The teensy experience included a lot of difficulties, some of which we already got working on, and some of which i’m not even going to bother getting into because of the xpadder issue.

So, it’s back to leonardo.  Spent some time repeating trials on the code which was worked on already and still found the same results of fail on analogs 2 and 3 (A2-A3 and A4-A5).  I changed the code to test normal analog on pins (A2-A3 and A4-A5) to confirm leonardo pins aren’t defective with this sketch which has the analog to digital stuff removed and a change to the pin assignment at the very top:

Code: [Select]
#define STICK_X 2
#define STICK_Y 3
#define OVERVAL 0

int Xstick;
int Ystick;

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() {

pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);

  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   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
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

 
 
Joystick.sendState()
;}}

found the analog stick works just fine to control X Axis / Y Axis on pins (A2-A3 and A4-A5).  next thing to do is ...not sure yet :D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 13 December 2015, 00:42:36
i'd like to be able to report info from the serial monitor as previously noted would be helpful. 

latest version of the sketch we're working on is this i believe:
Code: [Select]
#define STICK_X A0
#define STICK_Y A1
#define OVERVAL 0

int Xstick;
int Ystick;

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);
  }
 
  Joystick.begin(false);
}

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

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 127, -127);
  Ystick = constrain(Ystick, -127, 127);
  Joystick.setYAxis(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
    {
      if(buttonState[i] == LOW)     // button has been pressed
      {
        Joystick.pressButton(i);    // press corresponding "joystick" button
      }
      else                          // button has been released
      {
        Joystick.releaseButton(i);  // release corresponding "joystick" button
      }
      oState[i] = buttonState[i];   // save state to compare next time
    }

    Temp = analogRead(A2);
    (Temp < -30) ? buttonState[8] = 1 : buttonState[8] = 0;
    (Temp >  30) ? buttonState[9] = 1 : buttonState[9] = 0;
   
    Temp = analogRead(A3);
    (Temp < -30) ? buttonState[10] = 1 : buttonState[10] = 0;
    (Temp >  30) ? buttonState[11] = 1 : buttonState[11] = 0;
 
    Temp = analogRead(A4);
    (Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
    (Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;
 
    Temp = analogRead(A5);
    (Temp < -30) ? buttonState[14] = 1 : buttonState[14] = 0;
    (Temp >  30) ? buttonState[15] = 1 : buttonState[15] = 0;
 
    // Update joystick state
    Joystick.sendState();
  }
}

would someone mind adding a serial print thing to the sketch?  i can only take away or change things in a sketch that's more than about 2 lines :rolleyes:

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 13 December 2015, 00:46:17

I've read here and there people havibg issues with peripherals on Usb3...

yeah me too. i've tried 2.0 on both PCs and get same result.  oh well...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 13 December 2015, 00:54:53
"no serial port name defined" is what I get when there's nothing set in tools -> port.  There's only one entry in the list so you'd think it would default to that but it doesn't.

leonardo doesn't do error message when opening serial monitor.  it opens but nothing appears.  just a blank page when trying before.  the sketch before that wouldn't work was from a tutorial.  the hello world one.  maybe there was something about that sketch that didn't work well with leonardo.
i want to try again with an addition to the sketch we got going. 
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 13 December 2015, 12:18:28
would someone mind adding a serial print thing to the sketch?  i can only take away or change things in a sketch that's more than about 2 lines :rolleyes:

Sure :)

Code: [Select]
#define STICK_X A0
#define STICK_Y A1
#define OVERVAL 0

int Xstick;
int Ystick;

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.begin(false);
}

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

  // Y axis computations
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 127, -127);
  Ystick = constrain(Ystick, -127, 127);
  Joystick.setYAxis(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
    {
      if(buttonState[i] == LOW)     // button has been pressed
      {
        Joystick.pressButton(i);    // press corresponding "joystick" button
      }
      else                          // button has been released
      {
        Joystick.releaseButton(i);  // release corresponding "joystick" button
      }
      oState[i] = buttonState[i];   // save state to compare next time
    }

    Temp = analogRead(A2);
    Serial.println(Temp)
    (Temp < -30) ? buttonState[8] = 1 : buttonState[8] = 0;
    (Temp >  30) ? buttonState[9] = 1 : buttonState[9] = 0;
   
    Temp = analogRead(A3);
    (Temp < -30) ? buttonState[10] = 1 : buttonState[10] = 0;
    (Temp >  30) ? buttonState[11] = 1 : buttonState[11] = 0;
 
    Temp = analogRead(A4);
    (Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
    (Temp >  30) ? buttonState[13] = 1 : buttonState[13] = 0;
 
    Temp = analogRead(A5);
    (Temp < -30) ? buttonState[14] = 1 : buttonState[14] = 0;
    (Temp >  30) ? buttonState[15] = 1 : buttonState[15] = 0;
 
    // Update joystick state
    Joystick.sendState();
  }
}

This will spam the serial with the reading from A2, so probaly 0 or max unless it's wired up and you're moving it.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Sun, 13 December 2015, 15:21:54
Did a quick sketch program that will output the values from A0, A1, A2, A3, A4 and A5 to the serial port every seconds. I've successfully tested it with my Arduino Mega2560 and it workedpush-buttons (so either -127 or 127 reading  :))).

Code: [Select]
// Includes
#include <stdio.h> // In order to use the sprintf() function

// Joysticks pinout
const int _JOY1_XAXIS = A0;
const int _JOY1_YAXIS = A1;
const int _JOY2_XAXIS = A2;
const int _JOY2_YAXIS = A3;
const int _JOY3_XAXIS = A4;
const int _JOY3_YAXIS = A5;

void setup()
{
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}

void loop()
{
  // Joystick 1
  int joy1_xvalue = map(analogRead(_JOY1_XAXIS), 0, 1023, -127,  127);
  int joy1_yvalue = map(analogRead(_JOY1_YAXIS), 0, 1023,  127, -127);

  // Joystick 2
  int joy2_xvalue = map(analogRead(_JOY2_XAXIS), 0, 1023, -127,  127);
  int joy2_yvalue = map(analogRead(_JOY2_YAXIS), 0, 1023,  127, -127);

  // Joystick 3
  int joy3_xvalue = map(analogRead(_JOY3_XAXIS), 0, 1023, -127,  127);
  int joy3_yvalue = map(analogRead(_JOY3_YAXIS), 0, 1023,  127, -127);

  // Print the results to the serial monitor:
  char buffer[256];
  sprintf(buffer, "Stick 1: %4d/%4d | Stick 2: %4d/%4d | Stick 3: %4d/%4d", joy1_xvalue, joy1_yvalue, joy2_xvalue, joy2_yvalue, joy3_xvalue, joy3_yvalue);
  Serial.println(buffer);

  // Wait 1 second before the next loop
  delay(1000);
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 13 December 2015, 21:39:43

Sure :)



This will spam the serial with the reading from A2, so probaly 0 or max unless it's wired up and you're moving it.

thanks pal, really appreciate it as always :-*  this one output this error message.

Code: [Select]
Arduino: 1.6.5 (Windows 7), TD: 1.26, Board: "Arduino Leonardo"

analog_a2_a3_test.ino: In function 'void loop()':
analog_a2_a3_test:56: error: expression cannot be used as a function
expression cannot be used as a function

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

lemme try the one below from GA
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 13 December 2015, 21:45:28
Did a quick sketch program that will output the values from A0, A1, A2, A3, A4 and A5 to the serial port every seconds. I've successfully tested it with my Arduino Mega2560 and it workedpush-buttons (so either -127 or 127 reading  :))).


works :thumb:

although i don't know what this stuff means, i hope it does give you guys some info.

the output continues indefinitely, i copied a bunch and here it is:

Code: [Select]
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -39/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -39/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57

that was with me doing nothing. not pressing any buttons or moving analog stick.

i just tried pressing the single button i have connected to pin 0.  but nothing happens in controller properties page.  the analog stick doesn't work at all either (i had it connected to A2-A3 during this serial monitor output recording).  i guess that's probably by design?  let me know if there's something i'm supposed to be doing other than just uploading the sketch and opening serial monitor.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Mon, 14 December 2015, 01:58:16
works :thumb:

although i don't know what this stuff means, i hope it does give you guys some info.

the output continues indefinitely, i copied a bunch and here it is:

Code: [Select]
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -39/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -39/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -59/  61 | Stick 2:  -40/  49 | Stick 3:  -54/  56
Stick 1:  -60/  62 | Stick 2:  -40/  49 | Stick 3:  -54/  57
Stick 1:  -61/  63 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  58
Stick 1:  -63/  65 | Stick 2:  -40/  49 | Stick 3:  -55/  57
Stick 1:  -62/  64 | Stick 2:  -40/  49 | Stick 3:  -55/  57

that was with me doing nothing. not pressing any buttons or moving analog stick.

i just tried pressing the single button i have connected to pin 0.  but nothing happens in controller properties page.  the analog stick doesn't work at all either (i had it connected to A2-A3 during this serial monitor output recording).  i guess that's probably by design?  let me know if there's something i'm supposed to be doing other than just uploading the sketch and opening serial monitor.

The sketch only outputs values read from the specified analog inputs. Try moving your stick to see if anything changes on the serial output. Just do not move too fast as it reads and print once every 1s. About the button, it is intended as the sketch does nothing on the Joystick axis / button side, just analog read and serial print.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 14 December 2015, 17:29:39
ok guys i got the serial monitor output for ya :D

1st section is /w analog connected to pins A0 A1
2nd section is /w analog connected to pins A2 A3
3rd section is /w analog connected to pins A4 A5

the readout is for the following physical activity I did /w the analog stick in each case the same.

5 seconds of no input from me
5 seconds of me pressing up
5 seconds of no input from me
5 seconds of me pressing down
5 seconds of no input from me
5 seconds of me pressing left
5 seconds of no input from me
5 seconds of me pressing right
10 seconds of me scrambling back to PC to hit control A control C to get the data into windows clipboard


edit: found i had some crossed wires.  re-testing now...

ok, here's it is:

Code: [Select]
Stick 1:  -36/  40 | Stick 2:  -50/  56 | Stick 3:  -59/  61
Stick 1:  -36/  40 | Stick 2:  -50/  56 | Stick 3:  -60/  62
Stick 1:  -36/  40 | Stick 2:  -51/  57 | Stick 3:  -61/  62
Stick 1:  -36/  40 | Stick 2:  -51/  57 | Stick 3:  -61/  62
Stick 1:  -36/  40 | Stick 2:  -51/  56 | Stick 3:  -60/  61
Stick 1:  -41/  40 | Stick 2:  -50/  56 | Stick 3:  -59/  60
Stick 1:  -46/ -13 | Stick 2:  -12/  28 | Stick 3:  -39/  45
Stick 1:  -46/ -13 | Stick 2:  -10/  25 | Stick 3:  -36/  42
Stick 1:  -46/ -13 | Stick 2:  -10/  25 | Stick 3:  -36/  42
Stick 1:  -46/ -13 | Stick 2:   -9/  24 | Stick 3:  -35/  42
Stick 1:  -46/ -13 | Stick 2:   -9/  25 | Stick 3:  -36/  43
Stick 1:  -46/  40 | Stick 2:  -48/  53 | Stick 3:  -57/  59
Stick 1:  -46/  40 | Stick 2:  -49/  55 | Stick 3:  -59/  60
Stick 1:  -46/  40 | Stick 2:  -50/  56 | Stick 3:  -60/  62
Stick 1:  -46/  40 | Stick 2:  -51/  56 | Stick 3:  -61/  62
Stick 1:  -46/  40 | Stick 2:  -51/  57 | Stick 3:  -61/  62
Stick 1:  -46/  42 | Stick 2:  -52/  57 | Stick 3:  -61/  61
Stick 1:  -48/ 102 | Stick 2:  -93/  87 | Stick 3:  -81/  76
Stick 1:  -48/ 102 | Stick 2:  -93/  87 | Stick 3:  -81/  76
Stick 1:  -48/ 102 | Stick 2:  -93/  86 | Stick 3:  -80/  75
Stick 1:  -48/ 102 | Stick 2:  -93/  86 | Stick 3:  -80/  75
Stick 1:  -48/ 102 | Stick 2:  -93/  86 | Stick 3:  -80/  76
Stick 1:  -48/ 103 | Stick 2:  -93/  87 | Stick 3:  -81/  77
Stick 1:  -48/  45 | Stick 2:  -55/  59 | Stick 3:  -62/  63
Stick 1:  -48/  45 | Stick 2:  -55/  59 | Stick 3:  -62/  63
Stick 1:  -48/  45 | Stick 2:  -55/  60 | Stick 3:  -63/  64
Stick 1:  -48/  45 | Stick 2:  -55/  60 | Stick 3:  -63/  64
Stick 1:  -48/  45 | Stick 2:  -55/  60 | Stick 3:  -63/  64
Stick 1:  -99/  32 | Stick 2:  -46/  53 | Stick 3:  -57/  59
Stick 1:  -99/  32 | Stick 2:  -45/  52 | Stick 3:  -56/  57
Stick 1: -100/  32 | Stick 2:  -44/  51 | Stick 3:  -55/  56
Stick 1:  -99/  32 | Stick 2:  -44/  50 | Stick 3:  -54/  55
Stick 1:  -99/  32 | Stick 2:  -44/  50 | Stick 3:  -54/  56
Stick 1:  -51/  40 | Stick 2:  -49/  54 | Stick 3:  -57/  58
Stick 1:  -51/  40 | Stick 2:  -50/  55 | Stick 3:  -58/  60
Stick 1:  -51/  40 | Stick 2:  -50/  56 | Stick 3:  -59/  61
Stick 1:  -51/  40 | Stick 2:  -51/  56 | Stick 3:  -60/  61
Stick 1:  -51/  40 | Stick 2:  -51/  57 | Stick 3:  -61/  62
Stick 1:   13/  41 | Stick 2:  -51/  57 | Stick 3:  -61/  62
Stick 1:   13/  41 | Stick 2:  -51/  57 | Stick 3:  -61/  62
Stick 1:   13/  41 | Stick 2:  -51/  56 | Stick 3:  -60/  61
Stick 1:   13/  41 | Stick 2:  -51/  56 | Stick 3:  -59/  60
Stick 1:   13/  41 | Stick 2:  -50/  55 | Stick 3:  -58/  59
Stick 1:   13/  41 | Stick 2:  -50/  55 | Stick 3:  -57/  58
Stick 1:  -33/  45 | Stick 2:  -54/  58 | Stick 3:  -60/  61
Stick 1:  -33/  45 | Stick 2:  -53/  56 | Stick 3:  -58/  59
Stick 1:  -33/  45 | Stick 2:  -54/  58 | Stick 3:  -61/  62
Stick 1:  -33/  45 | Stick 2:  -54/  58 | Stick 3:  -61/  62
Stick 1:  -33/  45 | Stick 2:  -54/  59 | Stick 3:  -62/  63
Stick 1:  -33/  45 | Stick 2:  -55/  60 | Stick 3:  -63/  63
Stick 1:  -33/  45 | Stick 2:  -55/  60 | Stick 3:  -63/  63
Stick 1:  -33/  45 | Stick 2:  -55/  59 | Stick 3:  -62/  62
Stick 1:  -33/  45 | Stick 2:  -54/  58 | Stick 3:  -61/  61
Stick 1:  -33/  45 | Stick 2:  -54/  58 | Stick 3:  -60/  60

Code: [Select]
Stick 1:  -60/  62 | Stick 2:  -53/  40 | Stick 3:  -48/  52
Stick 1:  -61/  64 | Stick 2:  -52/  40 | Stick 3:  -49/  53
Stick 1:  -63/  65 | Stick 2:  -53/  40 | Stick 3:  -49/  54
Stick 1:  -64/  66 | Stick 2:  -53/  40 | Stick 3:  -49/  54
Stick 1:  -63/  65 | Stick 2:  -52/  40 | Stick 3:  -49/  52
Stick 1:  -61/  62 | Stick 2:  -45/ -13 | Stick 3:  -10/  23
Stick 1:  -58/  61 | Stick 2:  -45/ -13 | Stick 3:   -9/  22
Stick 1:  -57/  59 | Stick 2:  -45/ -13 | Stick 3:   -9/  22
Stick 1:  -57/  59 | Stick 2:  -45/ -13 | Stick 3:   -9/  22
Stick 1:  -58/  60 | Stick 2:  -45/ -13 | Stick 3:   -9/  23
Stick 1:  -59/  61 | Stick 2:  -45/  -6 | Stick 3:  -15/  28
Stick 1:  -61/  64 | Stick 2:  -45/  40 | Stick 3:  -47/  52
Stick 1:  -63/  65 | Stick 2:  -45/  40 | Stick 3:  -48/  53
Stick 1:  -63/  65 | Stick 2:  -45/  40 | Stick 3:  -48/  52
Stick 1:  -62/  63 | Stick 2:  -45/  40 | Stick 3:  -48/  52
Stick 1:  -60/  62 | Stick 2:  -46/ 102 | Stick 3:  -89/  81
Stick 1:  -59/  61 | Stick 2:  -45/ 102 | Stick 3:  -90/  82
Stick 1:  -59/  61 | Stick 2:  -45/ 102 | Stick 3:  -90/  83
Stick 1:  -61/  62 | Stick 2:  -45/ 103 | Stick 3:  -91/  84
Stick 1:  -62/  63 | Stick 2:  -45/ 102 | Stick 3:  -91/  85
Stick 1:  -64/  65 | Stick 2:  -45/ 103 | Stick 3:  -92/  86
Stick 1:  -65/  66 | Stick 2:  -44/  45 | Stick 3:  -53/  57
Stick 1:  -63/  65 | Stick 2:  -45/  45 | Stick 3:  -52/  55
Stick 1:  -62/  64 | Stick 2:  -44/  44 | Stick 3:  -52/  54
Stick 1:  -60/  62 | Stick 2:  -45/  45 | Stick 3:  -51/  53
Stick 1:  -59/  62 | Stick 2: -100/  43 | Stick 3:  -50/  53
Stick 1:  -59/  61 | Stick 2: -100/  42 | Stick 3:  -49/  53
Stick 1:  -60/  62 | Stick 2: -100/  42 | Stick 3:  -50/  54
Stick 1:  -61/  63 | Stick 2: -100/  42 | Stick 3:  -50/  54
Stick 1:  -63/  65 | Stick 2: -100/  42 | Stick 3:  -51/  55
Stick 1:  -63/  64 | Stick 2:  -67/  40 | Stick 3:  -49/  53
Stick 1:  -63/  65 | Stick 2:  -50/  41 | Stick 3:  -49/  53
Stick 1:  -62/  64 | Stick 2:  -51/  41 | Stick 3:  -49/  52
Stick 1:  -61/  63 | Stick 2:  -50/  41 | Stick 3:  -48/  51
Stick 1:  -59/  61 | Stick 2:  -49/  41 | Stick 3:  -48/  51
Stick 1:  -58/  58 | Stick 2:   11/  49 | Stick 3:  -54/  56
Stick 1:  -60/  61 | Stick 2:   12/  49 | Stick 3:  -54/  57
Stick 1:  -61/  62 | Stick 2:   12/  49 | Stick 3:  -55/  57
Stick 1:  -63/  64 | Stick 2:   12/  49 | Stick 3:  -55/  58
Stick 1:  -64/  64 | Stick 2:   12/  49 | Stick 3:  -55/  58
Stick 1:  -64/  64 | Stick 2:   13/  49 | Stick 3:  -55/  57
Stick 1:  -63/  64 | Stick 2:  -33/  45 | Stick 3:  -53/  55
Stick 1:  -59/  60 | Stick 2:  -33/  45 | Stick 3:  -50/  53
Stick 1:  -58/  60 | Stick 2:  -33/  45 | Stick 3:  -51/  53
Stick 1:  -59/  61 | Stick 2:  -33/  45 | Stick 3:  -51/  54
Stick 1:  -60/  61 | Stick 2:  -33/  45 | Stick 3:  -52/  55
Stick 1:  -61/  63 | Stick 2:  -33/  45 | Stick 3:  -52/  55
Stick 1:  -62/  64 | Stick 2:  -33/  45 | Stick 3:  -53/  56
Stick 1:  -63/  65 | Stick 2:  -33/  45 | Stick 3:  -53/  56
Stick 1:  -63/  65 | Stick 2:  -33/  45 | Stick 3:  -52/  55
Stick 1:  -63/  64 | Stick 2:  -33/  45 | Stick 3:  -52/  55
Stick 1:  -61/  63 | Stick 2:  -33/  45 | Stick 3:  -52/  54
Stick 1:  -60/  61 | Stick 2:  -33/  45 | Stick 3:  -51/  54
Stick 1:  -59/  61 | Stick 2:  -33/  45 | Stick 3:  -51/  54
Stick 1:  -60/  61 | Stick 2:  -33/  45 | Stick 3:  -52/  55
Stick 1:  -61/  63 | Stick 2:  -33/  45 | Stick 3:  -52/  55
Stick 1:  -62/  64 | Stick 2:  -33/  45 | Stick 3:  -53/  56
Stick 1:  -63/  65 | Stick 2:  -33/  45 | Stick 3:  -53/  56

Code: [Select]
Stick 1:  -54/  59 | Stick 2:  -64/  66 | Stick 3:  -33/  45
Stick 1:  -54/  58 | Stick 2:  -63/  64 | Stick 3:  -33/  45
Stick 1:  -53/  57 | Stick 2:  -62/  63 | Stick 3:  -33/  45
Stick 1:  -53/  56 | Stick 2:  -61/  62 | Stick 3:  -33/  45
Stick 1:  -52/  56 | Stick 2:  -60/  62 | Stick 3:  -33/  45
Stick 1:  -12/  26 | Stick 2:  -39/  47 | Stick 3:  -42/ -13
Stick 1:  -11/  26 | Stick 2:  -39/  47 | Stick 3:  -42/ -13
Stick 1:  -12/  27 | Stick 2:  -40/  48 | Stick 3:  -43/ -13
Stick 1:  -12/  27 | Stick 2:  -41/  49 | Stick 3:  -43/ -13
Stick 1:  -12/  27 | Stick 2:  -40/  48 | Stick 3:  -43/ -13
Stick 1:  -48/  53 | Stick 2:  -59/  61 | Stick 3:  -43/  39
Stick 1:  -48/  53 | Stick 2:  -58/  61 | Stick 3:  -43/  39
Stick 1:  -48/  53 | Stick 2:  -58/  60 | Stick 3:  -42/  38
Stick 1:  -48/  53 | Stick 2:  -58/  60 | Stick 3:  -43/  39
Stick 1:  -51/  55 | Stick 2:  -60/  63 | Stick 3:  -43/  42
Stick 1:  -91/  85 | Stick 2:  -83/  79 | Stick 3:  -43/  99
Stick 1:  -92/  86 | Stick 2:  -85/  81 | Stick 3:  -50/  99
Stick 1:  -92/  87 | Stick 2:  -85/  81 | Stick 3:  -50/ 100
Stick 1:  -92/  86 | Stick 2:  -85/  81 | Stick 3:  -50/ 100
Stick 1:  -92/  86 | Stick 2:  -84/  80 | Stick 3:  -50/  99
Stick 1:  -54/  57 | Stick 2:  -62/  64 | Stick 3:  -49/  45
Stick 1:  -53/  56 | Stick 2:  -61/  63 | Stick 3:  -49/  45
Stick 1:  -53/  56 | Stick 2:  -61/  63 | Stick 3:  -49/  45
Stick 1:  -53/  57 | Stick 2:  -62/  63 | Stick 3:  -49/  45
Stick 1:  -54/  57 | Stick 2:  -63/  65 | Stick 3:  -49/  45
Stick 1:  -54/  58 | Stick 2:  -64/  66 | Stick 3:  -99/  46
Stick 1:  -55/  59 | Stick 2:  -65/  67 | Stick 3:  -99/  46
Stick 1:  -55/  59 | Stick 2:  -64/  67 | Stick 3:  -99/  46
Stick 1:  -54/  58 | Stick 2:  -63/  66 | Stick 3:  -99/  46
Stick 1:  -54/  58 | Stick 2:  -63/  65 | Stick 3:  -99/  46
Stick 1:  -49/  54 | Stick 2:  -59/  61 | Stick 3:  -52/  40
Stick 1:  -49/  53 | Stick 2:  -59/  61 | Stick 3:  -52/  40
Stick 1:  -49/  53 | Stick 2:  -59/  61 | Stick 3:  -52/  40
Stick 1:  -49/  54 | Stick 2:  -60/  62 | Stick 3:  -52/  40
Stick 1:  -50/  55 | Stick 2:  -60/  63 | Stick 3:  -52/  40
Stick 1:  -50/  55 | Stick 2:  -62/  64 | Stick 3:  -49/  40
Stick 1:  -51/  56 | Stick 2:  -62/  64 | Stick 3:   11/  41
Stick 1:  -51/  56 | Stick 2:  -62/  64 | Stick 3:   12/  41
Stick 1:  -51/  56 | Stick 2:  -62/  63 | Stick 3:   12/  41
Stick 1:  -51/  55 | Stick 2:  -61/  62 | Stick 3:   12/  41
Stick 1:  -50/  55 | Stick 2:  -60/  61 | Stick 3:   13/  41
Stick 1:  -50/  54 | Stick 2:  -59/  60 | Stick 3:   13/  41
Stick 1:  -49/  53 | Stick 2:  -59/  61 | Stick 3:  -33/  40
Stick 1:  -49/  54 | Stick 2:  -59/  61 | Stick 3:  -33/  40
Stick 1:  -50/  55 | Stick 2:  -61/  63 | Stick 3:  -33/  40
Stick 1:  -49/  54 | Stick 2:  -60/  62 | Stick 3:  -33/  40
Stick 1:  -50/  56 | Stick 2:  -62/  64 | Stick 3:  -33/  40
Stick 1:  -50/  56 | Stick 2:  -62/  64 | Stick 3:  -33/  40
Stick 1:  -50/  56 | Stick 2:  -62/  64 | Stick 3:  -33/  40
Stick 1:  -50/  55 | Stick 2:  -61/  63 | Stick 3:  -33/  40
Stick 1:  -50/  55 | Stick 2:  -60/  62 | Stick 3:  -33/  40
Stick 1:  -49/  54 | Stick 2:  -59/  61 | Stick 3:  -33/  40
Stick 1:  -49/  54 | Stick 2:  -59/  61 | Stick 3:  -33/  40
Stick 1:  -49/  54 | Stick 2:  -59/  61 | Stick 3:  -33/  40
Stick 1:  -49/  54 | Stick 2:  -60/  62 | Stick 3:  -33/  40
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 14 December 2015, 17:33:48
let me know if the serial output tells us anything helpful and let me know i should do next.

if it would be helpful, i'm very happy to paypal you guys some funds so you can get a leonardo board and an analog stick to have and test.  that way we can eliminate this problem of you guys not having something to poke at ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 14 December 2015, 17:55:54
web results of another account of a guy finding that teensy and xpadder are a fail:

https://www.reddit.com/r/arduino/comments/2xn4i0/picked_up_a_teensy_31_and_want_to_use_it_with_an/

no web results found indicating anyone has successfully had teensy input recognized by xpadder.

leonardo certainly is big and clunky compared to teensy, and the firehose of a cable that's going to have to come out of the handset to go to a project box housing leonardo is unfortunate compared to how cool it would be to have teensy integrated into handset with just a usb cable gong from it to the PC, but oh well.

unless i discover some new info, leonardo it is for this project.  maybe in future another try can be had with teensy :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 14 December 2015, 17:57:37
Thanks for the offer but I have an Arduino Micro which is basically the same, and an analog stick.  Can I convince a sketch to compile and load for it?  That's another question entirely.  Actually I just tried GuilleAcoustic's serial print and it works!

What you should see in that output is the values for the pins the stick isn't connected to staying nearly the same - whatever they read in their middle position.  The only time you get close to this is if you don't move the stick and in the "stick 1" section of your second chunk.  My output looks similar.

I also have a diode here (one way resistor) and putting that between ground and an analog pin which is giving random values stops it jumping around, so once you get your 3 sticks in place you're good.

Next try - get your proper sketch to compile.  Though what the Linux equivalent of xpadder is I have no idea :P
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange 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 :(
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic on Tue, 15 December 2015, 07:12:40
Antimicro is another alternative to XPadder on Linux.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE 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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange 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;
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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:

[attach=1]

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. 
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic 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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE 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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange 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();
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE 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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic 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;
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 17 December 2015, 22:12:01
seems teensy will work very well here :cool:
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: GuilleAcoustic 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.

(http://i.imgur.com/tkSfwlJ.png)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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
[attach=1]

[attach=2]

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

[attach=3]

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

celebrating progress :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange 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!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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:

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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.
[attach=1]

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:
[attach=2]
[attach=3]

have removed the analog stick on top and proceeded with major teardown
[attach=4]

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.
[attach=5]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange 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 :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Bucake on Sun, 20 December 2015, 22:39:41
amazing progress!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 20 December 2015, 22:58:10
amazing progress!
:thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: 3K 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!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 23 December 2015, 00:15:50
[attach=1]
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:

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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:
[attach=1]

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

[attach=2]

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 ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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:
[attach=1]
[attach=2]
[attach=3]
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
[attach=4]
[attach=5]
[attach=6]

Got very good results after all the hard work, reducing the thumb distance to less than an inch :thumb:
[attach=8]
[attach=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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 30 December 2015, 06:18:38
I'm impressed that the wiring stays working through all these teardowns - good work!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet 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 ^-^
[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 30 December 2015, 19:07:28
[attach=1]

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 :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 01 January 2016, 15:40:30
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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 02 January 2016, 04:43:16
Your changes are correct but you also need another "True" in both the buttonState[] and oState[] arrays so it has something to compare :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 03 January 2016, 09:56:08
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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 03 January 2016, 11:46:30
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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 03 January 2016, 13:03:29
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 :)

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 04 January 2016, 16:39:37
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?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 05 January 2016, 15:45:20
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  ^-^
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 05 January 2016, 16:07:26
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:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 05 January 2016, 16:22:48
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 :'(
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Wed, 06 January 2016, 17:49:05
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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 07 January 2016, 13:55:17
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 ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 14 January 2016, 16:58:45
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 :-*



Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Thu, 14 January 2016, 17:27:20
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 :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 14 January 2016, 17:33:55
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:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 17 January 2016, 14:15:42
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:
[attach=1]
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
[attach=3]
[attach=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 :-[

[attach=5]
[attach=6]
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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 26 January 2016, 14:17:33
Hey guys, check out this awesome treasure I received in the mail today :-X
[attach=1]

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?
[attach=2]

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
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hoosieree on Tue, 26 January 2016, 18:17:50
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;
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Tue, 26 January 2016, 20:25:46
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.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hanya on Wed, 27 January 2016, 00:46:36
question, which one of these pinouts do i connect the power?
(Attachment Link)

the product page says they're all for power?  maybe any of the 3 can be used?
https://oshpark.com/shared_projects/2p7rQYx8
I've designed the board to be used for both older and newer analog stick. VCC pads are not connected each other on the board, so connect them to VCC. If you ignore the silk on the board, you can use the board as normal break out board.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 27 January 2016, 18:23:20
oh yeah, the idea for these tiny pcb's was hanya's.  arigatou ne, hanya-san :-*
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 05 February 2016, 16:10:44
Hey guys, not much of an update as far as progress goes.  Just checking in :)

I spent the past few weeks playing my b*lls off with the incomplete build that just has one analog stick and a cherry switch on top for flash and a second summoner spell as part of an alt keymap.

A while back as part of a failed design improvement, the device was unusable for almost 3 weeks and I had a bloodlust built up that was pretty out of control :confused:  So, I haven't had a chance to get to work on implementing the additional analog sticks on top because I've been too busy satisfying my bloodlust for the past 2 weeks or so.

I've also been chasing around a performance problem whereby one of the switches just dies for as long as 2 to 3 seconds at a time.  I think I have located the problem which is a weak looking soldering point on the teensy, and I resoldered it, but I can't be sure that I resolved the problem until I have a few games to confirm.  It's one of those intermittent problems we all love that only rear their ugly heads when no one is looking or once we have become convinced we've eradicated the problem >:D

I've also got another performance problem whereby I get random intermittent upward movements on the analog stick causing my camera to move up.This problem isn't nearly as disruptive as having a key die completely for 2 to 3 seconds.  That key problem resulted in me failing in my ranked provisional games due to some dropped commands in clutch moments before i was sure there was a real problem :'(  very frustrating

The random analog stick problem may not be solvable, and if not i can live with it.  giving teh controller a smack usually resolves it, but i've also noticed that doing a recalibration on the window usb game controllers utility seems to make it go away for a day or so..  I'll probably try some things such as swapping out some wiring or even swapping out the vita mod  for one of the newer ones from W11cE.  Although, I'm reluctant to discontinue use of the original mod because of some kind of strange loyalty I have to it :))

I have to do some work this weekend for my real work, but perhaps in around one or two weeks I can begin building up the top platform and planning the wire up for the additional analog sticks :D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 06 February 2016, 04:45:43
Ooh that doesn't sound fun, lets hope it was that solder joint letting you down!  If not you have some spare pins...

If the analog is only moving slightly the solution sounds like adding a small null zone in the middle, but this would of course mean stopping you being able to make movements of the same slowness when you want to.  Never played the game so not sure if this would be a problem?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 07 February 2016, 13:26:52
Vita sticks are not usually well centered. At least the ones I've had were not. I have a calibration code somewhere that saves the max and min axis values of the stick to EEPROM and centers and scales axes with those. A little tricky to use, since you have to move the stick at a correct time.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 14:17:08
Thanks for the feedback guys :)  I think I may have resolved those problems with some soldering because I haven't seen either the problem with the intermittently dying switch or the intermittently moving analog in about two or three games after some extra soldering.  We'll see after more time.

I installed a steel rod post as a foundation for analog 2

[attach=1]
The device now has a seat upon which analog 2 can rest with stability and adequate rigidity
[attach=2]
I did this assembly mockup before wire up just to check ergonomics (position and tilt). 
[attach=3]
I got pretty lucky on drilling and installing the steel rod allowing for ergonomics to be optimal
[attach=4]
[attach=5]
[attach=6]
[attach=7]

I forgot to mention that a few weeks ago I did an upgrade like this whereby I installed steel rod posts in a sugru bed as a foundation upon which outside leg keys for index and pinky finger sit.  Those keys require positioning that is a fair distance away from the internal skeleton of the outside leg.  So, soft materials to hold those two keys in place resulted in a little bit of wiggling and probable long-term falling apart.  Now those two keys are rock solid.

I did the wire up on analog 2 today, and now it can be used in game.  I'm just a little bit sad because along the way, a tragedy occurred.  I murdered one of the new vita mods :'(

In order to connect all three power holes together I tried dragging solder across all three to make a big solder blob.  I then connected one power cable to the center hole.  I noticed that making the big solder connective blob took a long time and the tiny board got very hot in the process.  I think I may have fried the board.

After wiring up the rest of the mod, I tested it and it worked fine.  I even played a off-line game to test flash and smite used on the second analog.  It worked fine temporarily, but after a few minutes I started getting continuous on activation of one direction of one of the axes.  Ultimately, it turns out that the x pinout on the mod no longer works.  I did troubleshooting for about an hour-and-a-half, swapping various things out and could never get the mod to work again :'(

Thereafter, I wired up another mod and was successful.  On the second mod, I connected three red wires from each independent hole and then combined those wires to form one power cable.

so, the dream is not only still alive but is even more so becoming reality:D  i'm just really disappointed that i murdered one vita mod.  it's an understatement to say those things are limited edition engineering fineries :-X

At this point, the device cosmetics have gone from ugly to outrageously hideous from all of the feverish rewiring to get everything back to working order with a second analog before i ran out of steam and monday hits.  i don't want to do anymore upgrades or installs that cause the device to be unusable when the work-week hits and make it so i can't play for several nights :-\
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 07 February 2016, 14:48:21
RIP Vita stick number 2, your sacrifice will not be in vain :(
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 14:52:24
lol, i'm reluctant to have its funeral until i keep it around for a while and try to resurrect it :))

but as we've seen, casualties do occur :confused:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 15:51:48
damn, got the same problem on the 2nd new vita mod.  it worked perfectly for about a half-hour, and then i lost an axis. 

no idea what's going on.  trying to troubleshoot but it looks like this mod won't work either.  i was very careful in handling this one. 

trying to see if there's some kind of short or other electrical cause...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 16:27:18
this appears to be some kind of electrical problem.  the dead axis is more like an intermittently stuck axis.  i can get it to unstick by molesting the device in various ways.  but one axis always goes back to continuous-on, or stuck as seen below in the pic with the hat indicating right is activated.

i don't know if i'll be able to solve this problem and will probably just end up having only 1 axis on each the 2nd and 3rd analog which will allow for 2 button commands on each instead of 4.

i can try swapping out the teensy which has always behaved strangely on this sketch with buttons 11 and 12 usually  stuck like this, and button 12 blinking hysterically.
[attach=1]
the stuck hat in the pic above is also blinking hysterically.  that's why i say this is probably some kind of electrical problem that's beyond my knowledge to fix other than trying to swap out wires and parts.

i'm guessing at this point that the 1st new vita mod that i thought i murdered is actually fine.  it's just this electrical problem that will probably affect all of the new mods...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sun, 07 February 2016, 16:37:06
Interesting, is it perhaps OK until it gets warmed up?  Not sure how enclosed the back is in your current design...

Hopefuly W11lcE or hanya are still watching this thread, they may have some idea what's going on.  At least it sounds like you didn't kill one :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 16:57:50
Actually, the way it works is, when i newly wire up everything after disconnecting, it works fine.

But after I use analog 2 by moving it around a little bit and watching the on screen hat response, I see 'right' blink intermittently with increasing frequency until it goes to continuous-on or stuck.

it's as if some kind of power bleed is getting drawn through like a magnet and finally taking hold.  as mentioned, poking and handling the device in various ways can get analog 2 to unstick or go to hysteria.  but no amount of molesting can get it to stay unstuck. it always goes back to stuck 'right' as in pic above.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 17:21:43
i've just now done 2 more troubleshooting experiments.

1st, i tried installing the new analog mod only without sharing the ground or power cables with anything else.  so, with the mod directly connected to the board, i get the exact same results.

next, i tried routing the power cable to the other 3.3v pin on the board.  unfortunately, i got the exact same results.

i think the mods might in fact be faulty, or i just don't know how to use them correclty.  i'll try wiring up another one next weekend or so.

here are some pics of the wireup on the new mod (the 2nd one today).
[attach=1]
[attach=2]
you can see i did a good job of soldering these points.  from there, the wires go to the board.  red goes to power. black goes to ground. the 2 yellows go to pins A2 and A3. i've redone the connections on the board about 5 times now, so i doubt it's an issue of a weak connection there.

i also tried connecting to pins A4 and A5 to rule out a problem on the board.  same results.

i also tried connecting the psp analog stick just to troubleshoot further, and that one worked perfectly even when sharing power and ground with the other components.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 18:21:12
just wired up a 3rd new mod and got the exact same results.  one axis works perfectly, the other is stuck in one direction.  this time left >:D

i've got to give it up for tonight.  monday is nearly here and the device is an unusable mess for next week. oh well.

at any rate,  HEEEEEEEEELLP 

obviously there's something wrong, and it's consistent across 3 of the 4 newly received mods (i haven't tried the 4th and last one).
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 07 February 2016, 18:23:38
Could you try with another vita stick? That flat ribbon cable breaks easily.
Also could you get actual axis values? The button conversion is not good for debugging as it can behave unpredictably if the axes bounce wildly.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 18:40:08
oh hi W11cE thanks for reply  :)

i already tried another vita stick while troubleshooting earlier.

the only way i know how to get values is from xpadder as seen below. does this give you the information you need?
[attach=1]

if there is some other way i should get the values, please let me know and i'll try;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 07 February 2016, 18:53:36
No, the xpadder cant show the axis values.

This will write the values to serial monitor:
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);
Serial.print("Xhat: ");
Serial.println(Xhat);
Serial.print("Yhat: ");
Serial.println(Yhat);
Serial.println("---------------------");
delay(50);

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;
}
}
Dont use this for gaming. (I added 50 ms delay to the loop)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 19:02:46
ok, i was able to upload this sketch.  but the serial monitor failed to open and i get this error message with 'no serial port name defined':
Code: [Select]
Arduino: 1.6.5 (Windows 7), TD: 1.26, Board: "Teensy 3.2 / 3.1, Serial + Keyboard + Mouse + Joystick, 96 MHz optimized (overclock), US English"

Sketch uses 19,896 bytes (7%) of program storage space. Maximum is 262,144 bytes.

Global variables use 6,532 bytes (9%) of dynamic memory, leaving 59,004 bytes for local variables. Maximum is 65,536 bytes.

Teensy did not respond to a USB-based request to automatically reboot.

Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.

no serial port name defined

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 07 February 2016, 19:09:27
You have to select the correct serial port from the tools menu.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 19:49:13
oh sorry, i usually have trouble getting serial monitor to work :(


i should have sent this before.  here's the settings in IDE at the bottom. 
[attach=1]

if you can't find any problem, i can try another pc  ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 07 February 2016, 22:15:12
hey i got serial monitor to work by changing usb type to keyboard + mouse + joystick :thumb:

[attach=1]

and here's the values from the serial monitor:

Code: [Select]
Xhat: 81
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 84
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 81
Yhat: 488
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 488
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 84
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 84
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 80
Yhat: 488
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 81
Yhat: 488
---------------------
Xhat: 84
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 488
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 488
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 72
Yhat: 488
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 488
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 81
Yhat: 488
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 528
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 69
Yhat: 489
---------------------
Xhat: 69
Yhat: 489
---------------------
Xhat: 69
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 488
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 488
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 71
Yhat: 488
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 71
Yhat: 488
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 488
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 488
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 79
Yhat: 488
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 488
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 81
Yhat: 488
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 90
Yhat: 489
---------------------
Xhat: 92
Yhat: 489
---------------------
Xhat: 92
Yhat: 489
---------------------
Xhat: 90
Yhat: 488
---------------------
Xhat: 89
Yhat: 489
---------------------
Xhat: 89
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 89
Yhat: 489
---------------------
Xhat: 89
Yhat: 489
---------------------
Xhat: 85
Yhat: 489
---------------------
Xhat: 85
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 89
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 84
Yhat: 489
---------------------
Xhat: 90
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 82
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 89
Yhat: 488
---------------------
Xhat: 87
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 29
Yhat: 489
---------------------
Xhat: 29
Yhat: 488
---------------------
Xhat: 82
Yhat: 488
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 29
Yhat: 489
---------------------
Xhat: 29
Yhat: 489
---------------------
Xhat: 29
Yhat: 488
---------------------
Xhat: 29
Yhat: 489
---------------------
Xhat: 29
Yhat: 489
---------------------
Xhat: 30
Yhat: 489
---------------------
Xhat: 30
Yhat: 489
---------------------
Xhat: 30
Yhat: 488
---------------------
Xhat: 30
Yhat: 489
---------------------
Xhat: 30
Yhat: 489
---------------------
Xhat: 30
Yhat: 489
---------------------
Xhat: 30
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 493
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 77
Yhat: 488
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 60
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 69
Yhat: 489
---------------------
Xhat: 54
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 62
Yhat: 488
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 63
Yhat: 488
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 60
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 78
Yhat: 488
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 77
Yhat: 488
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 488
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 88
Yhat: 489
---------------------
Xhat: 89
Yhat: 489
---------------------
Xhat: 86
Yhat: 488
---------------------
Xhat: 86
Yhat: 488
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 85
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 85
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 74
Yhat: 488
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 66
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 56
Yhat: 490
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 75
Yhat: 488
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 74
Yhat: 488
---------------------
Xhat: 75
Yhat: 488
---------------------
Xhat: 81
Yhat: 489
---------------------
Xhat: 76
Yhat: 488
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 68
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 74
Yhat: 488
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 78
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 85
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 69
Yhat: 489
---------------------
Xhat: 67
Yhat: 489
---------------------
Xhat: 66
Yhat: 489
---------------------
Xhat: 67
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 66
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 72
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 54
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 63
Yhat: 488
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 83
Yhat: 489
---------------------
Xhat: 61
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 54
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 75
Yhat: 488
---------------------
Xhat: 76
Yhat: 488
---------------------
Xhat: 84
Yhat: 489
---------------------
Xhat: 79
Yhat: 488
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 71
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 56
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 24
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 54
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 61
Yhat: 489
---------------------
Xhat: 62
Yhat: 488
---------------------
Xhat: 63
Yhat: 488
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 58
Yhat: 489
---------------------
Xhat: 57
Yhat: 489
---------------------
Xhat: 61
Yhat: 489
---------------------
Xhat: 60
Yhat: 488
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 66
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 65
Yhat: 489
---------------------
Xhat: 57
Yhat: 489
---------------------
Xhat: 67
Yhat: 489
---------------------
Xhat: 64
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 61
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 68
Yhat: 489
---------------------
Xhat: 66
Yhat: 489
---------------------
Xhat: 59
Yhat: 489
---------------------
Xhat: 55
Yhat: 489
---------------------
Xhat: 58
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 57
Yhat: 489
---------------------
Xhat: 51
Yhat: 489
---------------------
Xhat: 25
Yhat: 489
---------------------
Xhat: 60
Yhat: 489
---------------------
Xhat: 60
Yhat: 489
---------------------
Xhat: 59
Yhat: 489
---------------------
Xhat: 55
Yhat: 489
---------------------
Xhat: 60
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 61
Yhat: 489
---------------------
Xhat: 59
Yhat: 488
---------------------
Xhat: 59
Yhat: 489
---------------------
Xhat: 58
Yhat: 489
---------------------
Xhat: 57
Yhat: 489
---------------------
Xhat: 57
Yhat: 489
---------------------
Xhat: 56
Yhat: 489
---------------------
Xhat: 56
Yhat: 488
---------------------
Xhat: 55
Yhat: 489
---------------------
Xhat: 53
Yhat: 489
---------------------
Xhat: 55
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 80
Yhat: 489
---------------------
Xhat: 86
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 79
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 77
Yhat: 489
---------------------
Xhat: 76
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 75
Yhat: 489
---------------------
Xhat: 73
Yhat: 489
---------------------
Xhat: 62
Yhat: 489
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 69
Yhat: 489
---------------------
Xhat: 68
Yhat: 488
---------------------
Xhat: 70
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 74
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 56
Yhat: 489
---------------------
Xhat: 27
Yhat: 489
---------------------
Xhat: 63
Yhat: 489
---------------------
Xhat: 67
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 58
Yhat: 489
---------------------
Xhat: 28
Yhat: 489
---------------------
Xhat: 29
Yhat: 489
---------------------
Xhat: 55
Yhat: 489
---------------------
Xhat: 50
Yhat: 488
---------------------
Xhat: 26
Yhat: 489
---------------------
Xhat: 26
Yhat: 489
---------------------
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 08 February 2016, 09:02:23
i forgot you might need the values of the stick while it's moving.  the values i posted before were of the stick not moved at all.

here is output on serial monitor while i moved the stick up, down, left, and right for 5 seconds followed by a 5 second period of no stick movement while i hit control a and control c to copy the results:

Code: [Select]
Xhat: 5
Yhat: 486
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 481
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 483
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 476
---------------------
Xhat: 5
Yhat: 432
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 416
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 416
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 4
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 4
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 418
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 417
---------------------
Xhat: 5
Yhat: 415
---------------------
Xhat: 5
Yhat: 484
---------------------
Xhat: 5
Yhat: 486
---------------------
Xhat: 5
Yhat: 489
---------------------
Xhat: 5
Yhat: 489
---------------------
Xhat: 5
Yhat: 489
---------------------
Xhat: 5
Yhat: 490
---------------------
Xhat: 5
Yhat: 489
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 486
---------------------
Xhat: 5
Yhat: 475
---------------------
Xhat: 5
Yhat: 202
---------------------
Xhat: 5
Yhat: 197
---------------------
Xhat: 5
Yhat: 192
---------------------
Xhat: 5
Yhat: 189
---------------------
Xhat: 5
Yhat: 190
---------------------
Xhat: 5
Yhat: 177
---------------------
Xhat: 5
Yhat: 198
---------------------
Xhat: 5
Yhat: 182
---------------------
Xhat: 5
Yhat: 192
---------------------
Xhat: 5
Yhat: 260
---------------------
Xhat: 5
Yhat: 175
---------------------
Xhat: 5
Yhat: 225
---------------------
Xhat: 5
Yhat: 195
---------------------
Xhat: 5
Yhat: 232
---------------------
Xhat: 5
Yhat: 196
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 196
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 198
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 198
---------------------
Xhat: 5
Yhat: 271
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 6
Yhat: 198
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 247
---------------------
Xhat: 5
Yhat: 199
---------------------
Xhat: 5
Yhat: 199
---------------------
Xhat: 5
Yhat: 201
---------------------
Xhat: 5
Yhat: 201
---------------------
Xhat: 5
Yhat: 266
---------------------
Xhat: 5
Yhat: 201
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 159
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 217
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 4
Yhat: 190
---------------------
Xhat: 4
Yhat: 240
---------------------
Xhat: 5
Yhat: 237
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 202
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 232
---------------------
Xhat: 5
Yhat: 232
---------------------
Xhat: 5
Yhat: 223
---------------------
Xhat: 5
Yhat: 251
---------------------
Xhat: 5
Yhat: 232
---------------------
Xhat: 5
Yhat: 234
---------------------
Xhat: 5
Yhat: 241
---------------------
Xhat: 5
Yhat: 256
---------------------
Xhat: 5
Yhat: 245
---------------------
Xhat: 5
Yhat: 249
---------------------
Xhat: 5
Yhat: 231
---------------------
Xhat: 5
Yhat: 222
---------------------
Xhat: 5
Yhat: 244
---------------------
Xhat: 5
Yhat: 236
---------------------
Xhat: 5
Yhat: 219
---------------------
Xhat: 5
Yhat: 210
---------------------
Xhat: 5
Yhat: 228
---------------------
Xhat: 5
Yhat: 221
---------------------
Xhat: 5
Yhat: 207
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 194
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 209
---------------------
Xhat: 5
Yhat: 209
---------------------
Xhat: 5
Yhat: 211
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 210
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 4
Yhat: 205
---------------------
Xhat: 5
Yhat: 189
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 227
---------------------
Xhat: 5
Yhat: 207
---------------------
Xhat: 5
Yhat: 197
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 5
Yhat: 202
---------------------
Xhat: 5
Yhat: 197
---------------------
Xhat: 4
Yhat: 207
---------------------
Xhat: 5
Yhat: 199
---------------------
Xhat: 5
Yhat: 195
---------------------
Xhat: 5
Yhat: 207
---------------------
Xhat: 5
Yhat: 203
---------------------
Xhat: 4
Yhat: 207
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 6
Yhat: 220
---------------------
Xhat: 5
Yhat: 191
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 207
---------------------
Xhat: 5
Yhat: 237
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 209
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 208
---------------------
Xhat: 5
Yhat: 175
---------------------
Xhat: 5
Yhat: 208
---------------------
Xhat: 5
Yhat: 224
---------------------
Xhat: 5
Yhat: 174
---------------------
Xhat: 5
Yhat: 211
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 216
---------------------
Xhat: 5
Yhat: 246
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 6
Yhat: 224
---------------------
Xhat: 5
Yhat: 264
---------------------
Xhat: 4
Yhat: 224
---------------------
Xhat: 5
Yhat: 260
---------------------
Xhat: 5
Yhat: 223
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 201
---------------------
Xhat: 5
Yhat: 228
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 198
---------------------
Xhat: 5
Yhat: 151
---------------------
Xhat: 5
Yhat: 206
---------------------
Xhat: 5
Yhat: 211
---------------------
Xhat: 5
Yhat: 205
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 5
Yhat: 207
---------------------
Xhat: 5
Yhat: 204
---------------------
Xhat: 5
Yhat: 207
---------------------
Xhat: 5
Yhat: 197
---------------------
Xhat: 5
Yhat: 200
---------------------
Xhat: 5
Yhat: 210
---------------------
Xhat: 5
Yhat: 229
---------------------
Xhat: 5
Yhat: 419
---------------------
Xhat: 5
Yhat: 486
---------------------
Xhat: 5
Yhat: 485
---------------------
Xhat: 5
Yhat: 489
---------------------
Xhat: 5
Yhat: 498
---------------------
Xhat: 5
Yhat: 497
---------------------
Xhat: 5
Yhat: 590
---------------------
Xhat: 5
Yhat: 727
---------------------
Xhat: 5
Yhat: 727
---------------------
Xhat: 5
Yhat: 726
---------------------
Xhat: 5
Yhat: 727
---------------------
Xhat: 5
Yhat: 730
---------------------
Xhat: 5
Yhat: 733
---------------------
Xhat: 5
Yhat: 734
---------------------
Xhat: 5
Yhat: 735
---------------------
Xhat: 5
Yhat: 738
---------------------
Xhat: 5
Yhat: 739
---------------------
Xhat: 5
Yhat: 738
---------------------
Xhat: 5
Yhat: 737
---------------------
Xhat: 5
Yhat: 737
---------------------
Xhat: 5
Yhat: 737
---------------------
Xhat: 5
Yhat: 736
---------------------
Xhat: 5
Yhat: 736
---------------------
Xhat: 5
Yhat: 750
---------------------
Xhat: 5
Yhat: 736
---------------------
Xhat: 5
Yhat: 735
---------------------
Xhat: 5
Yhat: 735
---------------------
Xhat: 5
Yhat: 733
---------------------
Xhat: 5
Yhat: 732
---------------------
Xhat: 5
Yhat: 731
---------------------
Xhat: 5
Yhat: 731
---------------------
Xhat: 5
Yhat: 731
---------------------
Xhat: 5
Yhat: 729
---------------------
Xhat: 5
Yhat: 730
---------------------
Xhat: 5
Yhat: 729
---------------------
Xhat: 5
Yhat: 729
---------------------
Xhat: 5
Yhat: 729
---------------------
Xhat: 5
Yhat: 726
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 722
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 723
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 722
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 721
---------------------
Xhat: 5
Yhat: 720
---------------------
Xhat: 5
Yhat: 719
---------------------
Xhat: 5
Yhat: 719
---------------------
Xhat: 5
Yhat: 718
---------------------
Xhat: 5
Yhat: 718
---------------------
Xhat: 5
Yhat: 718
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 718
---------------------
Xhat: 5
Yhat: 718
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 716
---------------------
Xhat: 5
Yhat: 717
---------------------
Xhat: 5
Yhat: 715
---------------------
Xhat: 5
Yhat: 715
---------------------
Xhat: 5
Yhat: 713
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 711
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 4
Yhat: 711
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 710
---------------------
Xhat: 5
Yhat: 703
---------------------
Xhat: 5
Yhat: 702
---------------------
Xhat: 5
Yhat: 701
---------------------
Xhat: 5
Yhat: 636
---------------------
Xhat: 5
Yhat: 488
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 486
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 4
Yhat: 485
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Xhat: 5
Yhat: 487
---------------------
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 08 February 2016, 09:41:43
So those Y values are what you're hoping for: 210 is less than 512-128, 485 is within 128 of 512, and 710 is more than 512+128, so it works.

The X value reads 5 no matter which way you move the stick - this is beyond the limits of the stick (which will bottom out at a similar value to Y, around 210) and it's practically zero which means it's shorted either to either ground or power (not sure which way it reads the values)

Assuming it's not actually shorted you'll need to work out when it goes wrong.

Does it get stuck after a while plugged in without you pressing the stick?
If not does it get stuck if you push the stick far enough to register but not all the way?
Or does it only get stuck after you've pressed it a certain way (e.g up and left)?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 08 February 2016, 16:30:06
Thanks for the feedback orange :-*



Does it get stuck after a while plugged in without you pressing the stick?

When I first connect the device in the course of a new wireup, the analog is not stuck and functions properly for at least a few seconds. 

The only time the analog is not stuck is when I have completely disconnected the wiring and done a new wire up.  i've done that many times in the course of troubleshooting by trying another new mod, or swapping out wiring, or swapping out the vita stick, or trying on pins A4 A5 instead of A2 A3.

i've seen this many times now, and for the first several times thought i resolved the problem because i get at least a few seconds of proper functioning.

If I just disconnect and  reconnect the usb cable after the analog has already become stuck, it will be stuck when I reconnect it just like it was before disconnecting.  It almost seems like there is some kind of static charge that builds up and won't let go unless the device is not only disconnected from USB, but the analog stick and mod are actually removed from the teensy by way of desoldering.



Or does it only get stuck after you've pressed it a certain way (e.g up and left)?

After a new wireup, if I move up-and-down on the good axis, it doesn't seem to exacerbate the bad axis getting stuck.  When I move left and right on the bad axis I get hysteria on one side for a little while, and then that side eventually becomes stuck after just a few seconds.  It seems that moving the stick in the direction that eventually becomes stuck causes its to become stuck.

If not does it get stuck if you push the stick far enough to register but not all the way?

I'll work on this particular troubleshooting test later today or tomorrow.

Does it get stuck after a while plugged in without you pressing the stick?

I have never tried doing a new wire up, connecting the device, seeing that it is not stuck, and just letting it sit there to see if it becomes stuck.  I will try to soon as I get a chance ;)


Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Mon, 08 February 2016, 17:03:18
Could you get the values from the stick when it is working after you have reconnected the wires ?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 10 February 2016, 09:05:10
Could you get the values from the stick when it is working after you have reconnected the wires ?

new mod#2 is working on hat right now after rewiring it.  new mod#2 actually worked for a full 20 minute game before it became stuck before.  i don't know why it's working right now, and i don't know if or when it will become stuck again because i can't find any reason for it to do that.

here is serial output for new mod#2 on hat A2 A3 at rest:
Code: [Select]
Xhat: 549
Yhat: 493
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 549
Yhat: 497
---------------------
Xhat: 554
Yhat: 498
---------------------
Xhat: 548
Yhat: 499
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 550
Yhat: 499
---------------------
Xhat: 555
Yhat: 492
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 550
Yhat: 491
---------------------
Xhat: 550
Yhat: 491
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 548
Yhat: 495
---------------------
Xhat: 548
Yhat: 499
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 552
Yhat: 498
---------------------
Xhat: 553
Yhat: 492
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 499
---------------------
Xhat: 548
Yhat: 489
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 555
Yhat: 499
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 550
Yhat: 498
---------------------
Xhat: 549
Yhat: 500
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 500
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 553
Yhat: 490
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 554
Yhat: 499
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 550
Yhat: 499
---------------------
Xhat: 552
Yhat: 497
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 549
Yhat: 499
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 550
Yhat: 499
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 550
Yhat: 498
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 550
Yhat: 492
---------------------
Xhat: 549
Yhat: 489
---------------------
Xhat: 555
Yhat: 499
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 550
Yhat: 500
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 554
Yhat: 500
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 549
Yhat: 500
---------------------
Xhat: 551
Yhat: 499
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 554
Yhat: 500
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 553
Yhat: 492
---------------------
Xhat: 554
Yhat: 499
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 548
Yhat: 490
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 550
Yhat: 490
---------------------
Xhat: 552
Yhat: 500
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 552
Yhat: 498
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 550
Yhat: 498
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 553
Yhat: 500
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 551
Yhat: 499
---------------------
Xhat: 555
Yhat: 496
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 548
Yhat: 494
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 548
Yhat: 498
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 549
Yhat: 492
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 498
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 551
Yhat: 489
---------------------
Xhat: 555
Yhat: 492
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 549
Yhat: 497
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 552
Yhat: 489
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 549
Yhat: 491
---------------------
Xhat: 549
Yhat: 498
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 555
Yhat: 492
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 549
Yhat: 491
---------------------
Xhat: 554
Yhat: 491
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 551
Yhat: 499
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 554
Yhat: 500
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 548
Yhat: 499
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 554
Yhat: 491
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 553
Yhat: 500
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 492
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 548
Yhat: 496
---------------------
Xhat: 552
Yhat: 498
---------------------
Xhat: 551
Yhat: 499
---------------------
Xhat: 549
Yhat: 498
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 554
Yhat: 499
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 554
Yhat: 499
---------------------
Xhat: 551
Yhat: 499
---------------------
Xhat: 551
Yhat: 491
---------------------
Xhat: 552
Yhat: 499
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 549
Yhat: 491
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 549
Yhat: 491
---------------------
Xhat: 549
Yhat: 498
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 550
Yhat: 498
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 554
Yhat: 497
---------------------

here is serial output for new mod#2 on hat A2 A3 with me moving up, down, left, right for 5 seconds with an at rest delay at the beginning and end:
Code: [Select]
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 500
---------------------
Xhat: 551
Yhat: 490
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 554
Yhat: 499
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 553
Yhat: 491
---------------------
Xhat: 548
Yhat: 498
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 548
Yhat: 494
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 555
Yhat: 497
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 554
Yhat: 498
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 551
Yhat: 489
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 550
Yhat: 499
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 549
Yhat: 498
---------------------
Xhat: 552
Yhat: 500
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 547
Yhat: 497
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 548
Yhat: 488
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 533
Yhat: 487
---------------------
Xhat: 538
Yhat: 489
---------------------
Xhat: 520
Yhat: 493
---------------------
Xhat: 519
Yhat: 490
---------------------
Xhat: 511
Yhat: 489
---------------------
Xhat: 420
Yhat: 490
---------------------
Xhat: 469
Yhat: 492
---------------------
Xhat: 541
Yhat: 488
---------------------
Xhat: 537
Yhat: 489
---------------------
Xhat: 548
Yhat: 491
---------------------
Xhat: 546
Yhat: 490
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 556
Yhat: 491
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 548
Yhat: 496
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 552
Yhat: 491
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 550
Yhat: 491
---------------------
Xhat: 552
Yhat: 497
---------------------
Xhat: 552
Yhat: 489
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 554
Yhat: 498
---------------------
Xhat: 554
Yhat: 499
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 549
Yhat: 497
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 552
Yhat: 498
---------------------
Xhat: 550
Yhat: 499
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 550
Yhat: 491
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 551
Yhat: 490
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 553
Yhat: 499
---------------------
Xhat: 548
Yhat: 493
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 555
Yhat: 499
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 552
Yhat: 491
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 554
Yhat: 492
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 556
Yhat: 496
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 550
Yhat: 490
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 555
Yhat: 495
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 556
Yhat: 497
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 548
Yhat: 496
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 555
Yhat: 497
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 556
Yhat: 492
---------------------
Xhat: 555
Yhat: 495
---------------------
Xhat: 555
Yhat: 491
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 547
Yhat: 492
---------------------
Xhat: 547
Yhat: 486
---------------------
Xhat: 535
Yhat: 486
---------------------
Xhat: 543
Yhat: 488
---------------------
Xhat: 511
Yhat: 479
---------------------
Xhat: 490
Yhat: 482
---------------------
Xhat: 461
Yhat: 480
---------------------
Xhat: 437
Yhat: 485
---------------------
Xhat: 405
Yhat: 481
---------------------
Xhat: 361
Yhat: 483
---------------------
Xhat: 307
Yhat: 481
---------------------
Xhat: 285
Yhat: 464
---------------------
Xhat: 281
Yhat: 464
---------------------
Xhat: 386
Yhat: 464
---------------------
Xhat: 539
Yhat: 484
---------------------
Xhat: 548
Yhat: 488
---------------------
Xhat: 546
Yhat: 488
---------------------
Xhat: 550
Yhat: 489
---------------------
Xhat: 543
Yhat: 486
---------------------
Xhat: 551
Yhat: 487
---------------------
Xhat: 537
Yhat: 482
---------------------
Xhat: 350
Yhat: 437
---------------------
Xhat: 273
Yhat: 425
---------------------
Xhat: 271
Yhat: 428
---------------------
Xhat: 272
Yhat: 428
---------------------
Xhat: 273
Yhat: 426
---------------------
Xhat: 275
Yhat: 418
---------------------
Xhat: 273
Yhat: 419
---------------------
Xhat: 272
Yhat: 418
---------------------
Xhat: 272
Yhat: 422
---------------------
Xhat: 272
Yhat: 434
---------------------
Xhat: 272
Yhat: 433
---------------------
Xhat: 271
Yhat: 436
---------------------
Xhat: 271
Yhat: 433
---------------------
Xhat: 272
Yhat: 434
---------------------
Xhat: 271
Yhat: 430
---------------------
Xhat: 271
Yhat: 432
---------------------
Xhat: 272
Yhat: 439
---------------------
Xhat: 271
Yhat: 438
---------------------
Xhat: 272
Yhat: 435
---------------------
Xhat: 271
Yhat: 438
---------------------
Xhat: 271
Yhat: 442
---------------------
Xhat: 272
Yhat: 439
---------------------
Xhat: 272
Yhat: 443
---------------------
Xhat: 271
Yhat: 437
---------------------
Xhat: 271
Yhat: 439
---------------------
Xhat: 271
Yhat: 439
---------------------
Xhat: 272
Yhat: 439
---------------------
Xhat: 273
Yhat: 439
---------------------
Xhat: 271
Yhat: 436
---------------------
Xhat: 271
Yhat: 435
---------------------
Xhat: 271
Yhat: 435
---------------------
Xhat: 272
Yhat: 436
---------------------
Xhat: 271
Yhat: 433
---------------------
Xhat: 271
Yhat: 430
---------------------
Xhat: 271
Yhat: 428
---------------------
Xhat: 271
Yhat: 423
---------------------
Xhat: 272
Yhat: 424
---------------------
Xhat: 271
Yhat: 421
---------------------
Xhat: 272
Yhat: 419
---------------------
Xhat: 272
Yhat: 421
---------------------
Xhat: 272
Yhat: 421
---------------------
Xhat: 271
Yhat: 419
---------------------
Xhat: 272
Yhat: 420
---------------------
Xhat: 272
Yhat: 423
---------------------
Xhat: 272
Yhat: 417
---------------------
Xhat: 272
Yhat: 419
---------------------
Xhat: 271
Yhat: 420
---------------------
Xhat: 272
Yhat: 421
---------------------
Xhat: 274
Yhat: 421
---------------------
Xhat: 274
Yhat: 416
---------------------
Xhat: 274
Yhat: 417
---------------------
Xhat: 271
Yhat: 421
---------------------
Xhat: 273
Yhat: 418
---------------------
Xhat: 273
Yhat: 419
---------------------
Xhat: 271
Yhat: 420
---------------------
Xhat: 272
Yhat: 422
---------------------
Xhat: 273
Yhat: 422
---------------------
Xhat: 272
Yhat: 421
---------------------
Xhat: 273
Yhat: 420
---------------------
Xhat: 274
Yhat: 422
---------------------
Xhat: 274
Yhat: 420
---------------------
Xhat: 274
Yhat: 420
---------------------
Xhat: 273
Yhat: 417
---------------------
Xhat: 274
Yhat: 421
---------------------
Xhat: 274
Yhat: 419
---------------------
Xhat: 273
Yhat: 417
---------------------
Xhat: 274
Yhat: 414
---------------------
Xhat: 276
Yhat: 416
---------------------
Xhat: 275
Yhat: 415
---------------------
Xhat: 276
Yhat: 418
---------------------
Xhat: 274
Yhat: 417
---------------------
Xhat: 276
Yhat: 415
---------------------
Xhat: 273
Yhat: 413
---------------------
Xhat: 274
Yhat: 407
---------------------
Xhat: 273
Yhat: 415
---------------------
Xhat: 273
Yhat: 406
---------------------
Xhat: 273
Yhat: 411
---------------------
Xhat: 273
Yhat: 406
---------------------
Xhat: 274
Yhat: 414
---------------------
Xhat: 277
Yhat: 409
---------------------
Xhat: 277
Yhat: 412
---------------------
Xhat: 274
Yhat: 414
---------------------
Xhat: 273
Yhat: 407
---------------------
Xhat: 275
Yhat: 405
---------------------
Xhat: 278
Yhat: 405
---------------------
Xhat: 275
Yhat: 400
---------------------
Xhat: 273
Yhat: 409
---------------------
Xhat: 276
Yhat: 405
---------------------
Xhat: 275
Yhat: 408
---------------------
Xhat: 285
Yhat: 417
---------------------
Xhat: 539
Yhat: 492
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 552
Yhat: 491
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 552
Yhat: 491
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 555
Yhat: 497
---------------------
Xhat: 552
Yhat: 491
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 556
Yhat: 493
---------------------
Xhat: 568
Yhat: 492
---------------------
Xhat: 572
Yhat: 489
---------------------
Xhat: 575
Yhat: 490
---------------------
Xhat: 583
Yhat: 498
---------------------
Xhat: 679
Yhat: 493
---------------------
Xhat: 806
Yhat: 496
---------------------
Xhat: 820
Yhat: 488
---------------------
Xhat: 820
Yhat: 493
---------------------
Xhat: 817
Yhat: 494
---------------------
Xhat: 823
Yhat: 498
---------------------
Xhat: 819
Yhat: 506
---------------------
Xhat: 823
Yhat: 517
---------------------
Xhat: 820
Yhat: 520
---------------------
Xhat: 824
Yhat: 526
---------------------
Xhat: 817
Yhat: 526
---------------------
Xhat: 818
Yhat: 540
---------------------
Xhat: 817
Yhat: 542
---------------------
Xhat: 816
Yhat: 540
---------------------
Xhat: 812
Yhat: 542
---------------------
Xhat: 815
Yhat: 554
---------------------
Xhat: 799
Yhat: 582
---------------------
Xhat: 800
Yhat: 591
---------------------
Xhat: 800
Yhat: 586
---------------------
Xhat: 800
Yhat: 587
---------------------
Xhat: 797
Yhat: 583
---------------------
Xhat: 800
Yhat: 580
---------------------
Xhat: 803
Yhat: 589
---------------------
Xhat: 800
Yhat: 581
---------------------
Xhat: 800
Yhat: 583
---------------------
Xhat: 801
Yhat: 584
---------------------
Xhat: 805
Yhat: 582
---------------------
Xhat: 802
Yhat: 592
---------------------
Xhat: 801
Yhat: 583
---------------------
Xhat: 805
Yhat: 587
---------------------
Xhat: 802
Yhat: 591
---------------------
Xhat: 801
Yhat: 581
---------------------
Xhat: 805
Yhat: 582
---------------------
Xhat: 800
Yhat: 582
---------------------
Xhat: 802
Yhat: 593
---------------------
Xhat: 800
Yhat: 581
---------------------
Xhat: 804
Yhat: 582
---------------------
Xhat: 801
Yhat: 588
---------------------
Xhat: 801
Yhat: 591
---------------------
Xhat: 803
Yhat: 584
---------------------
Xhat: 804
Yhat: 580
---------------------
Xhat: 802
Yhat: 581
---------------------
Xhat: 802
Yhat: 580
---------------------
Xhat: 803
Yhat: 583
---------------------
Xhat: 800
Yhat: 578
---------------------
Xhat: 804
Yhat: 581
---------------------
Xhat: 801
Yhat: 579
---------------------
Xhat: 799
Yhat: 580
---------------------
Xhat: 805
Yhat: 578
---------------------
Xhat: 803
Yhat: 577
---------------------
Xhat: 798
Yhat: 577
---------------------
Xhat: 807
Yhat: 581
---------------------
Xhat: 806
Yhat: 578
---------------------
Xhat: 799
Yhat: 578
---------------------
Xhat: 803
Yhat: 578
---------------------
Xhat: 808
Yhat: 581
---------------------
Xhat: 806
Yhat: 579
---------------------
Xhat: 807
Yhat: 580
---------------------
Xhat: 804
Yhat: 579
---------------------
Xhat: 807
Yhat: 580
---------------------
Xhat: 806
Yhat: 580
---------------------
Xhat: 806
Yhat: 577
---------------------
Xhat: 803
Yhat: 580
---------------------
Xhat: 805
Yhat: 577
---------------------
Xhat: 802
Yhat: 581
---------------------
Xhat: 802
Yhat: 576
---------------------
Xhat: 803
Yhat: 581
---------------------
Xhat: 809
Yhat: 578
---------------------
Xhat: 806
Yhat: 575
---------------------
Xhat: 807
Yhat: 580
---------------------
Xhat: 805
Yhat: 580
---------------------
Xhat: 809
Yhat: 577
---------------------
Xhat: 809
Yhat: 575
---------------------
Xhat: 805
Yhat: 574
---------------------
Xhat: 802
Yhat: 578
---------------------
Xhat: 803
Yhat: 575
---------------------
Xhat: 801
Yhat: 576
---------------------
Xhat: 807
Yhat: 574
---------------------
Xhat: 803
Yhat: 578
---------------------
Xhat: 807
Yhat: 573
---------------------
Xhat: 805
Yhat: 577
---------------------
Xhat: 802
Yhat: 575
---------------------
Xhat: 806
Yhat: 578
---------------------
Xhat: 803
Yhat: 577
---------------------
Xhat: 800
Yhat: 573
---------------------
Xhat: 804
Yhat: 571
---------------------
Xhat: 805
Yhat: 574
---------------------
Xhat: 801
Yhat: 571
---------------------
Xhat: 802
Yhat: 571
---------------------
Xhat: 808
Yhat: 574
---------------------
Xhat: 803
Yhat: 573
---------------------
Xhat: 807
Yhat: 572
---------------------
Xhat: 802
Yhat: 573
---------------------
Xhat: 801
Yhat: 575
---------------------
Xhat: 805
Yhat: 573
---------------------
Xhat: 806
Yhat: 574
---------------------
Xhat: 803
Yhat: 569
---------------------
Xhat: 807
Yhat: 571
---------------------
Xhat: 692
Yhat: 549
---------------------
Xhat: 558
Yhat: 490
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 556
Yhat: 493
---------------------
Xhat: 557
Yhat: 496
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 556
Yhat: 493
---------------------
Xhat: 551
Yhat: 498
---------------------
Xhat: 556
Yhat: 495
---------------------
Xhat: 556
Yhat: 492
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 556
Yhat: 498
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 556
Yhat: 493
---------------------
Xhat: 557
Yhat: 495
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 558
Yhat: 493
---------------------
Xhat: 541
Yhat: 494
---------------------
Xhat: 551
Yhat: 481
---------------------
Xhat: 553
Yhat: 482
---------------------
Xhat: 556
Yhat: 493
---------------------
Xhat: 555
Yhat: 495
---------------------
Xhat: 553
Yhat: 491
---------------------
Xhat: 558
Yhat: 468
---------------------
Xhat: 552
Yhat: 361
---------------------
Xhat: 552
Yhat: 200
---------------------
Xhat: 551
Yhat: 198
---------------------
Xhat: 555
Yhat: 200
---------------------
Xhat: 552
Yhat: 199
---------------------
Xhat: 550
Yhat: 198
---------------------
Xhat: 555
Yhat: 198
---------------------
Xhat: 553
Yhat: 199
---------------------
Xhat: 545
Yhat: 201
---------------------
Xhat: 545
Yhat: 199
---------------------
Xhat: 546
Yhat: 199
---------------------
Xhat: 542
Yhat: 199
---------------------
Xhat: 545
Yhat: 200
---------------------
Xhat: 537
Yhat: 199
---------------------
Xhat: 541
Yhat: 200
---------------------
Xhat: 533
Yhat: 200
---------------------
Xhat: 544
Yhat: 201
---------------------
Xhat: 537
Yhat: 199
---------------------
Xhat: 541
Yhat: 198
---------------------
Xhat: 545
Yhat: 199
---------------------
Xhat: 545
Yhat: 200
---------------------
Xhat: 541
Yhat: 200
---------------------
Xhat: 535
Yhat: 200
---------------------
Xhat: 543
Yhat: 200
---------------------
Xhat: 544
Yhat: 199
---------------------
Xhat: 543
Yhat: 199
---------------------
Xhat: 542
Yhat: 200
---------------------
Xhat: 545
Yhat: 201
---------------------
Xhat: 542
Yhat: 200
---------------------
Xhat: 542
Yhat: 199
---------------------
Xhat: 539
Yhat: 199
---------------------
Xhat: 542
Yhat: 201
---------------------
Xhat: 544
Yhat: 201
---------------------
Xhat: 542
Yhat: 200
---------------------
Xhat: 547
Yhat: 202
---------------------
Xhat: 535
Yhat: 200
---------------------
Xhat: 547
Yhat: 198
---------------------
Xhat: 540
Yhat: 201
---------------------
Xhat: 542
Yhat: 202
---------------------
Xhat: 541
Yhat: 199
---------------------
Xhat: 542
Yhat: 199
---------------------
Xhat: 543
Yhat: 201
---------------------
Xhat: 535
Yhat: 200
---------------------
Xhat: 535
Yhat: 198
---------------------
Xhat: 543
Yhat: 201
---------------------
Xhat: 539
Yhat: 200
---------------------
Xhat: 543
Yhat: 200
---------------------
Xhat: 542
Yhat: 201
---------------------
Xhat: 546
Yhat: 202
---------------------
Xhat: 546
Yhat: 199
---------------------
Xhat: 535
Yhat: 200
---------------------
Xhat: 532
Yhat: 200
---------------------
Xhat: 541
Yhat: 198
---------------------
Xhat: 541
Yhat: 202
---------------------
Xhat: 537
Yhat: 200
---------------------
Xhat: 536
Yhat: 200
---------------------
Xhat: 535
Yhat: 200
---------------------
Xhat: 545
Yhat: 203
---------------------
Xhat: 543
Yhat: 201
---------------------
Xhat: 544
Yhat: 203
---------------------
Xhat: 539
Yhat: 199
---------------------
Xhat: 538
Yhat: 199
---------------------
Xhat: 547
Yhat: 199
---------------------
Xhat: 538
Yhat: 200
---------------------
Xhat: 536
Yhat: 200
---------------------
Xhat: 537
Yhat: 199
---------------------
Xhat: 544
Yhat: 201
---------------------
Xhat: 540
Yhat: 201
---------------------
Xhat: 541
Yhat: 199
---------------------
Xhat: 544
Yhat: 201
---------------------
Xhat: 539
Yhat: 199
---------------------
Xhat: 546
Yhat: 201
---------------------
Xhat: 542
Yhat: 200
---------------------
Xhat: 546
Yhat: 200
---------------------
Xhat: 537
Yhat: 201
---------------------
Xhat: 537
Yhat: 200
---------------------
Xhat: 544
Yhat: 200
---------------------
Xhat: 540
Yhat: 201
---------------------
Xhat: 540
Yhat: 201
---------------------
Xhat: 542
Yhat: 198
---------------------
Xhat: 543
Yhat: 200
---------------------
Xhat: 547
Yhat: 199
---------------------
Xhat: 543
Yhat: 203
---------------------
Xhat: 541
Yhat: 201
---------------------
Xhat: 543
Yhat: 201
---------------------
Xhat: 536
Yhat: 202
---------------------
Xhat: 537
Yhat: 199
---------------------
Xhat: 545
Yhat: 199
---------------------
Xhat: 536
Yhat: 200
---------------------
Xhat: 543
Yhat: 201
---------------------
Xhat: 543
Yhat: 201
---------------------
Xhat: 546
Yhat: 215
---------------------
Xhat: 542
Yhat: 491
---------------------
Xhat: 549
Yhat: 492
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 548
Yhat: 496
---------------------
Xhat: 548
Yhat: 495
---------------------
Xhat: 548
Yhat: 495
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 547
Yhat: 496
---------------------
Xhat: 548
Yhat: 494
---------------------
Xhat: 547
Yhat: 491
---------------------
Xhat: 547
Yhat: 494
---------------------
Xhat: 548
Yhat: 488
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 549
Yhat: 492
---------------------
Xhat: 549
Yhat: 492
---------------------
Xhat: 544
Yhat: 496
---------------------
Xhat: 550
Yhat: 500
---------------------
Xhat: 548
Yhat: 499
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 547
Yhat: 495
---------------------
Xhat: 557
Yhat: 496
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 555
Yhat: 498
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 563
Yhat: 552
---------------------
Xhat: 535
Yhat: 706
---------------------
Xhat: 531
Yhat: 743
---------------------
Xhat: 526
Yhat: 747
---------------------
Xhat: 531
Yhat: 746
---------------------
Xhat: 530
Yhat: 749
---------------------
Xhat: 538
Yhat: 750
---------------------
Xhat: 573
Yhat: 746
---------------------
Xhat: 575
Yhat: 744
---------------------
Xhat: 578
Yhat: 747
---------------------
Xhat: 577
Yhat: 745
---------------------
Xhat: 577
Yhat: 747
---------------------
Xhat: 581
Yhat: 747
---------------------
Xhat: 585
Yhat: 750
---------------------
Xhat: 583
Yhat: 746
---------------------
Xhat: 582
Yhat: 745
---------------------
Xhat: 585
Yhat: 744
---------------------
Xhat: 588
Yhat: 749
---------------------
Xhat: 582
Yhat: 748
---------------------
Xhat: 580
Yhat: 745
---------------------
Xhat: 580
Yhat: 748
---------------------
Xhat: 583
Yhat: 748
---------------------
Xhat: 579
Yhat: 746
---------------------
Xhat: 579
Yhat: 745
---------------------
Xhat: 584
Yhat: 749
---------------------
Xhat: 581
Yhat: 745
---------------------
Xhat: 578
Yhat: 746
---------------------
Xhat: 577
Yhat: 747
---------------------
Xhat: 587
Yhat: 744
---------------------
Xhat: 579
Yhat: 744
---------------------
Xhat: 582
Yhat: 749
---------------------
Xhat: 580
Yhat: 747
---------------------
Xhat: 581
Yhat: 749
---------------------
Xhat: 581
Yhat: 749
---------------------
Xhat: 583
Yhat: 745
---------------------
Xhat: 579
Yhat: 748
---------------------
Xhat: 578
Yhat: 747
---------------------
Xhat: 581
Yhat: 749
---------------------
Xhat: 576
Yhat: 749
---------------------
Xhat: 581
Yhat: 748
---------------------
Xhat: 580
Yhat: 745
---------------------
Xhat: 579
Yhat: 748
---------------------
Xhat: 581
Yhat: 743
---------------------
Xhat: 582
Yhat: 750
---------------------
Xhat: 581
Yhat: 747
---------------------
Xhat: 578
Yhat: 745
---------------------
Xhat: 580
Yhat: 744
---------------------
Xhat: 578
Yhat: 743
---------------------
Xhat: 579
Yhat: 747
---------------------
Xhat: 580
Yhat: 749
---------------------
Xhat: 578
Yhat: 747
---------------------
Xhat: 576
Yhat: 748
---------------------
Xhat: 578
Yhat: 744
---------------------
Xhat: 581
Yhat: 747
---------------------
Xhat: 578
Yhat: 749
---------------------
Xhat: 580
Yhat: 745
---------------------
Xhat: 580
Yhat: 747
---------------------
Xhat: 578
Yhat: 746
---------------------
Xhat: 577
Yhat: 748
---------------------
Xhat: 578
Yhat: 746
---------------------
Xhat: 575
Yhat: 749
---------------------
Xhat: 580
Yhat: 746
---------------------
Xhat: 581
Yhat: 749
---------------------
Xhat: 576
Yhat: 749
---------------------
Xhat: 576
Yhat: 749
---------------------
Xhat: 578
Yhat: 748
---------------------
Xhat: 580
Yhat: 746
---------------------
Xhat: 578
Yhat: 744
---------------------
Xhat: 577
Yhat: 745
---------------------
Xhat: 577
Yhat: 745
---------------------
Xhat: 577
Yhat: 748
---------------------
Xhat: 578
Yhat: 749
---------------------
Xhat: 583
Yhat: 747
---------------------
Xhat: 581
Yhat: 749
---------------------
Xhat: 583
Yhat: 746
---------------------
Xhat: 577
Yhat: 746
---------------------
Xhat: 581
Yhat: 749
---------------------
Xhat: 581
Yhat: 745
---------------------
Xhat: 579
Yhat: 749
---------------------
Xhat: 580
Yhat: 746
---------------------
Xhat: 581
Yhat: 750
---------------------
Xhat: 582
Yhat: 747
---------------------
Xhat: 576
Yhat: 749
---------------------
Xhat: 576
Yhat: 748
---------------------
Xhat: 578
Yhat: 747
---------------------
Xhat: 583
Yhat: 749
---------------------
Xhat: 579
Yhat: 748
---------------------
Xhat: 581
Yhat: 750
---------------------
Xhat: 578
Yhat: 748
---------------------
Xhat: 577
Yhat: 746
---------------------
Xhat: 580
Yhat: 745
---------------------
Xhat: 577
Yhat: 748
---------------------
Xhat: 581
Yhat: 747
---------------------
Xhat: 577
Yhat: 747
---------------------
Xhat: 578
Yhat: 748
---------------------
Xhat: 580
Yhat: 744
---------------------
Xhat: 579
Yhat: 748
---------------------
Xhat: 589
Yhat: 745
---------------------
Xhat: 565
Yhat: 695
---------------------
Xhat: 548
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 554
Yhat: 490
---------------------
Xhat: 554
Yhat: 491
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 554
Yhat: 489
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 554
Yhat: 489
---------------------
Xhat: 550
Yhat: 492
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 554
Yhat: 492
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 551
Yhat: 489
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 549
Yhat: 497
---------------------
Xhat: 549
Yhat: 489
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 552
Yhat: 491
---------------------
Xhat: 554
Yhat: 492
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 553
Yhat: 492
---------------------
Xhat: 555
Yhat: 495
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 552
Yhat: 497
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 554
Yhat: 491
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 551
Yhat: 491
---------------------
Xhat: 554
Yhat: 491
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 555
Yhat: 489
---------------------
Xhat: 553
Yhat: 491
---------------------
Xhat: 551
Yhat: 490
---------------------
Xhat: 549
Yhat: 497
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 555
Yhat: 496
---------------------
Xhat: 553
Yhat: 497
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 550
Yhat: 492
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 550
Yhat: 492
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 554
Yhat: 491
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 554
Yhat: 492
---------------------
Xhat: 555
Yhat: 496
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 550
Yhat: 497
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 549
Yhat: 497
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 552
Yhat: 492
---------------------
Xhat: 549
Yhat: 491
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 549
Yhat: 490
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 549
Yhat: 492
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 549
Yhat: 490
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 554
Yhat: 492
---------------------
Xhat: 550
Yhat: 493
---------------------
Xhat: 551
Yhat: 491
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 552
Yhat: 490
---------------------
Xhat: 554
Yhat: 493
---------------------
Xhat: 554
Yhat: 497
---------------------
Xhat: 554
Yhat: 489
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 549
Yhat: 489
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 552
Yhat: 497
---------------------
Xhat: 554
Yhat: 495
---------------------
Xhat: 555
Yhat: 494
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 553
Yhat: 490
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 548
Yhat: 492
---------------------
Xhat: 553
Yhat: 495
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 551
Yhat: 495
---------------------
Xhat: 553
Yhat: 496
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 556
Yhat: 496
---------------------
Xhat: 553
Yhat: 492
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 555
Yhat: 492
---------------------
Xhat: 551
Yhat: 496
---------------------
Xhat: 551
Yhat: 497
---------------------
Xhat: 550
Yhat: 494
---------------------
Xhat: 549
Yhat: 493
---------------------
Xhat: 551
Yhat: 493
---------------------
Xhat: 551
Yhat: 490
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 549
Yhat: 491
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 549
Yhat: 489
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 553
Yhat: 498
---------------------
Xhat: 552
Yhat: 489
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 553
Yhat: 494
---------------------
Xhat: 552
Yhat: 493
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 555
Yhat: 495
---------------------
Xhat: 552
Yhat: 496
---------------------
Xhat: 554
Yhat: 494
---------------------
Xhat: 549
Yhat: 494
---------------------
Xhat: 553
Yhat: 493
---------------------
Xhat: 550
Yhat: 496
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 555
Yhat: 493
---------------------
Xhat: 554
Yhat: 496
---------------------
Xhat: 555
Yhat: 496
---------------------
Xhat: 552
Yhat: 495
---------------------
Xhat: 551
Yhat: 490
---------------------
Xhat: 551
Yhat: 492
---------------------
Xhat: 549
Yhat: 495
---------------------
Xhat: 551
Yhat: 491
---------------------
Xhat: 550
Yhat: 495
---------------------
Xhat: 554
Yhat: 490
---------------------
Xhat: 552
Yhat: 494
---------------------
Xhat: 551
Yhat: 494
---------------------
Xhat: 549
Yhat: 496
---------------------
Xhat: 552
Yhat: 494
---------------------

i think the numbers above show that it&#
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 10 February 2016, 09:11:03
my previous post failed to post completely, and i can't modify it.  it seems corrupted and can't be modified.

continuing...

i think the numbers above show that it's working perfectly, right?

i have also tried new mod #2 as analog on A0 A1, and it works perfectly. 

I will continue using new mod #2 to see if it will become stock or dead again.


Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 10 February 2016, 09:22:59
old mod has always worked well as analog.  it also worked in my tests in the past as analog to digital on A2 A3 and A4 A5, and today i changed it from analog A0 A1 to analog to digital A4 A5 to test it.  it works perfectly there.  i checked this setup to rule out any problem with these pins on the board.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 10 February 2016, 09:28:03
Could you get the values from the stick when it is working after you have reconnected the wires ?

new mod #3 fails upon wireup. so, i cannot post axis values before it becomes stuck or dead on one axis.  it fails with one dead axis immediately upon connecting.

new mod #3 also fails as analog on A0 A1 with the result of one axis working well, and one axis dead.

i'll try some more testing on new mods 1, 3, and 4 in the coming days.  if i can't get them to work in any configuration, i might try buying another teensy board to see if they will work that way.

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 12 February 2016, 20:08:30
Hey guys, I've got a final determination on the new mods after some additional testing :cool:

Two of the four new mods work perfectly, and the other two just don't work.

That's okay, because I now have a total of three working mods (2 new ones, and the old one) that will allow me to complete construction of the device to have 3 vita sticks on top :D

I now have it put together with two working analog sticks and will likely take a break from the project for a week or two to just enjoy using the device ^-^

Thereafter, I will install a steel rod post upon which to mount the third analog stick to the left side of the others and will then have my dream game controller.

I'll post the work that's done for that piece of the project in the coming weeks.

Thereafter, the remaining work will just be for cosmetics and durability. 

So, this is great news and I think we are seeing the very latest stages of this project which will probably be coming to an end in no more than 30 days :p
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 12 February 2016, 22:40:05
hey guys, wondering if you can help with a small tweak.

on each stick, one of the axes is reversed.  moving up on the analog stick results in down, and moving down on the stick results in up.  this has always been the case since W11cE gave us the working sketch several weeks ago.

same with the hat stick.

i've been able to override this issue using xpadder for league, so it's not a problem at all there.  but some other games recognize the analog sticks natively without xpadder.  and trying to use xpadder for override in those games results in hysteria.  the analog stick's input is read natively as up, for example, while xpadder is sending an override of down.  so, the character will just stutter in place.

i tried looking at the sketch to see if i could figure out how to reverse it, but i can't figure it out.  can someone please try to help?

if someone can help with this, it will be to reverse the opposite axis than what you're expecting. 

the following will make this tweak a bit confusing to implement, and some trial and error might be needed...

due to the orientation of the ribbon cable, i've had to reverse the x and y cables when connecting them to the board.  if i don't, then left/right and up/down are reversed.  so, i've got the x pinouts connected to A1 and A3 instead of A0 and A2 as specified here.

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

#define HAT_X   2
#define HAT_Y   3


here's the full sketch from W11cE i've been using for several weeks that i'm trying to figure out how to change:

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 was guessing that maybe it's this section that needs to be swapped or reversed, but i don't know how to do it:

Code: [Select]
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);

i tried a few things such as inserting a '-' in front of overval, but nothing changed in the performance :rolleyes:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 13 February 2016, 04:20:02
I think you need to take the value read from 1023 to inverse it (I've put it on Xstick - it's first thing in the morning so can't get my head around mapping X/Y to up/down :-[)

Code: [Select]
void loop()
{
  // X axis computations
  Xstick = map(1023-analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
  Xstick = constrain(Xstick, 0, 1023);
  Joystick.X(Xstick);
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Tue, 16 February 2016, 13:16:24
Yes, that works. Or by changing whats already there, like this:
Code: [Select]
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);->
Code: [Select]
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 0, 1023);
You can read more about map from here:
https://www.arduino.cc/en/Reference/Map
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Tue, 16 February 2016, 13:27:43
Yes, that works. Or by changing whats already there, like this:
Code: [Select]
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);->
Code: [Select]
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 0, 1023);
You can read more about map from here:
https://www.arduino.cc/en/Reference/Map

Interesting, thanks :)

Seems this function isn't really doing much here as 'overall' is not set and the values read are only in the middle half of the range (around 250-750) so the camera could be more sensitive?  I guess that's tweaking for when everything works...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Tue, 16 February 2016, 15:36:28
Yes. This is the most simple way to scale the axis, which in most cases would be necessary with vita stick. Now it is not really doing anything.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 26 February 2016, 16:39:05
Hey guys, thanks for the help swapping the analog y-axis.  I tried it just now, and it works well :thumb:

Recently I have just been playing every day and enjoying.  The device's performance is outstanding :D

I've only done a little bit of work recently about once a week to refine ergonomics by repositioning the keys one by one when I find the time.  Ergonomics at this point are just about 100% :cool:

[attach=1]
[attach=2]
[attach=3]
[attach=4]
[attach=5]
The wiring at the top for the analog sticks is still just temporary and obviously requires a total revision.  So, the device is still extremely ugly because of that.  However, once I have the third analog stick and do the complete wiring revision, I will be able to begin the final finish on the device which should make it comparable to other game controllers in terms of how it looks sitting in a room as a pc peripheral. 

The final finish will be to trim down the Clay by about 1 or 2 mm and then replace the material that was removed with Sugru.  I've already done this on one key: the outside index finger key.  It is therefore now permanent.  When I'm able to, I will do this with each section of surface area until the entire device has a Sugru shell.

Can you guys tell me what I need to swap in this piece of the code in order to fix the inverted y-axis that remains on the hat?

Code: [Select]
//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);
  }

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hoosieree on Fri, 26 February 2016, 23:27:38
Here's a potential solution (untested!) that

Code: [Select]
#include <math.h>  // atan2, M_PI, square, sqrt

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

int HAT_ZERO = -1;
int hat_angle[] = {0,45,90,135,180,225,270,315};

//// HELPERS
// like Arduino's `map`, but with doubles instead of longs
double dmap(double x,double in_min,double in_max,double out_min,double out_max)
{
    return (x-in_min)*(out_max-out_min)/(in_max-in_min)+out_min;
}

bool close_enough(int actual,int ideal,int arc)
{
    // smaller value results in narrower valid angles (requires more accuracy)
    // must be less than or equal to 22, or coords will overlap
    arc = constrain(arc,1,22)/2;  // half an arc in each direction
    int ub = ideal+arc;  // upper bound
    int lb = (ideal?ideal:360)-arc;  // lower bound
    return (ideal?(lb<actual&&actual<ub):(lb<actual||actual<ub));
}

//// JOYSTICK
// x and y coordinates to Joystick degrees
//
// Usage:
// Joystick.hat(xy_to_joy(Xhat,Yhat));
// Joystick.hat(xy_to_joy(Xhat,Yhat,true));  // invert y axis
int xy_to_joy(int x,int y,bool inv_y=false)
{
    // normalize coordinates
    double mx = dmap((double)x,0,1023,-1.0,1.0);
    double my = dmap((double)y,0,1023,(inv_y?1.0:-1.0),(inv_y?-1.0:1.0));

    // convert rectangular to polar coordinates
    double r = sqrt(square(mx)+square(my));
    double radius_keepout = 0.125;
    if (r < radius_keepout) {
        // Previously, hatThreshold was set to 128, which is about 1/8 of 1023,
        // so I tried to keep the same relative amount.
        return HAT_ZERO;  // inside of "radius dead zone"
    } else {
        // return nearest hat degrees
        int degrees = int(M_PI/180*(M_PI+atan2(my,mx)));
        for (int i=0;i<8;++i) {
            int arc_width = 40;
            // arc_width 40 gives dead zones 5 degrees wide at:
            // 22.5 67.5 112.5 157.5 202.5 247.5 292.5 337.5
            if (close_enough(degrees,hat_angle[i],arc_width)) {
                return hat_angle[i];
            }
        }
        return HAT_ZERO;  // inside of "angle dead zone"
    }
}
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 27 February 2016, 04:39:23
Interesting hoosieree - looks like you went for the circular deadzone gettin pi involved? I'm on my phone so will have a read later :)

An easier (but way less impressive) fix would be to do the same as the other stick, like this. Please check the capitalisation!

Code: [Select]
YHat = 1024 - analogRead(HAT_Y);
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hoosieree on Sat, 27 February 2016, 10:17:32
Derp, I had more text in my reply but chopped it out accidentally.  You got the gist though.  It first scales/offsets the analogRead x and y values so each is between -1 and 1.  Then it converts rectangular to polar coordinates so you can adjust the central deadzone with just one parameter.  There's also the ability to adjust dead zones in between the different hat angles if you want.  Not sure if it's desirable, but you can set it to 45 to make it go away.

Just noticed a mistake in my code, it should say:

Code: [Select]
arc = constrain(arc,1,45)/2;  // half an arc in each direction
//                             ^^ 1/8 of a circle in degrees, corresponding to 8 "hat" angles.

I migrated from 8-bit AVR to 32-bit Teensy 3.x a while back and it's really freeing to be able to use real math when the problem calls for it, so that's what I prefer.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 05 March 2016, 15:29:54
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.

Hey guys, I'm back to working on trying to increase the nullzone for the analog to digital hats.

I just now implemented this line to fix the inversion problem
Code: [Select]
Yhat = 1024 - analogRead(HAT_Y); 

thanks for helping with that  :-*  it works

 and now I'm interested in finally resolving the null zone issue

As I mentioned before, I actually need a square nullzone that is sizable in order to avoid inadvertent keypresses.  A square nullzone minimizes the probability of inadvertent keypresses due to sideways movement.

Thanks for the recent solution that allows for complex numerous adjustments and customizability allowing for what I'm guessing is unlimited variations in size and shape of the null zone.  That's quite a bit beyond my ability and needs in this application, but I'm hoping that code will benefit somebody who has a specific need for such a tailored nullzone for some game that requires it.

I just need to know which one of these numbers to change in order to increase the square nullzone to something like 50%

Code: [Select]
//HAT
  Xhat = analogRead(HAT_X);
  Yhat = 1024 - 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);
  }

Performance otherwise on the device is outstanding  :))

i'm able to play ranked games with my friends and everything :D

there are just a few troublespots at the moment that are preventing me from moving foreward.

one is the zero nullzone in the one hat that has been implemented which is causing me to Inadvertently activate some commands sometimes.  Example, I press up to Flash and end up also Healing which is mapped to right due to a slight right-side movement in addition to my attempt to press up only.

The other issue that is preventing me from moving forward is that I constructed the device in a way such that the pinky finger keys are too close to each other.  They actually pinch my pinky enough to be around 20% depressed.  In other words, inserting my pinky in between the two pinky finger keys causes each of them to be pressed by around 10 or 20%.  Since the outside pinky key is mapped to the shop, I often inadvertently open the shop in the middle of a team fight, which is fairly well disastrous  :-\

Unfortunately, while these kinds of adjustments are normally very easy with some adjustments of pulling or pushing a switch into or out of , or sideways in the Clay, I have run out of outward available distance because of the underlying rigid structure.  I therefore must redo the outside pinky finger steel rod foundation by tearing down the pinky finger key to reach the foundation of sugru and steel rod post which I may then redo.

After these issues are resolved, I plan to implement the third analog stick (hat2) :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Sat, 05 March 2016, 15:41:14
Sorry to hear about your bad shopping habits :p

The setting you need to change is actually this one near the top

Code: [Select]
const int hatThreshold = 128;
Bigger value = bigger nullzone.  Good luck with the rebuild :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 06 March 2016, 20:53:31
thanks orange, set it to 175 and now it's much easier to get a get discrete directional activations :thumb:

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 16 March 2016, 19:34:53
updaaaaaaaaaat3 :D

Hey guys, got an update.

The device now has around 25% of its surface area coated with a smooth Sugru layer effectively acting as a shell.  I have no real sculpting talent and there are lumpy areas that in certain light cause the device to take on the appearance of a monster in a Japanese horror film.  If I do some sanding, it will take away the shiny appearance of the cured Sugru, but I'm not sure I will bother with that :rolleyes:

[attach=1]
[attach=2]

In other news, as previously reported, only two of the four new mods from W11cE were found to work.  And so I have had one of them installed for hat1 and successfully using hat1 alongside the original true analog using the old mod for probably around six weeks now.

And then without any trauma or mishandling, the installed new mod for hat1 died.  The way it died was pretty goofy.  First, one axis went into partial death, halfway working but mostly having one direction on one axis stuck for a while until finally that axis died entirely.  Then, the other axis that was working had one direction die a day later.  One day after that the only remaining direction on that axis died as well leaving zero directions functioning.

Luckily I still have one more new mod from W11cE, which I have just now installed for hat1. 

Of course,Without a total of three working mods, I am unable to finish the device as originally designed with three analog sticks on top :'(

That is to say, the device is intended to have one analog stick for camera control, one analog stick as hat1 for summoner's spells (flash, teleport, ignite, etc.), and one analog stick as hat2 for in game item usage (health potions, shields, etc.).

Luckily, our friend W11cE was kind enough to agree to fabricate and send me two more old-style mods for cost :-*

Of course, as I always make sure to show my appreciation for the people who help me in my various goofball activities, I doubled the payment amount requested by W11cE :cool:  it's actually only $60 bucks, which in reality is not even half i'm sure of what would normally be required to have probably the world's most respected and talented game controller mod artisan to do such work. 

thanks again W11cE!

Hopefully I will have the two additional old-style mods within 30 days or so :cool:

Either way, I'd like to report that I continue to play daily for at least two hours in the evenings.  The device's performance remains outstanding.  I'm experiencing what I perceived to be absolutely zero usage trauma and cannot foresee any at any time in the future.  There is simply so little force required of the fingers and thumb to actuate the switches in my design that I have no concerns of injury, and i couldn't be happier with this project ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 20 April 2016, 17:42:47
sry for no recent updates guys. i've been working on it and will have updates as soon as i can nail down some open items ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 20 April 2016, 18:44:49
Your 'lack of update' post alerted me to the previous update - more dead sticks :(

Lets hope the new old ones are as reliable as the old old one is!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 21 April 2016, 15:00:18
lol orange, always good for a laugh :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 21 April 2016, 19:30:51
Hi guys, got a pretty good update for us ;)

Around 90% of the device is now permanent with a sugru shell.

The old-style mods from W11cE arrived about two weeks back.  Luckily, one of them works :))

Unfortunately, the second one has a dead axis upon arrival.  W11cE told me when shipping that he wasn't able to test the mods because his PS Vita analog stick's ribbon cable broke in two.  Of course I can't complain and am always grateful for W11cE going to the trouble of making these tricky items for me.  For what I'm paying, I can really only expect W11cE to make a best effort on the mods with the hope that they will work.  It isn't reasonable for us to expect any kind of guaranteed performance when this friend is essentially doing a favor.

With a newly received and working old-style mod, it seems I will be able to finish the device.  For probably the past 60 days, I have successfully been using the device with two analog sticks on top as last reported.  The primary analog stick, as always, is for camera control, and utilizes the first old-style mod received from W11cE.  The second analog stick, as reported previously, is for summoner spells such as flash/ignite/heal/etc. 

The mod facilitating use of the second analog stick is the only working new style mod from the set of four sent by W11cE some months ago.  The other three new style mods, as previously reported, all had one or more axes dead.

The 4th new style mod that is now in use also had a dead axis periodically as well, actually.  This axis death was temporary and would occur around once a week for one day or so earlier this year.  It was very strange.  I would simply wake my PC from sleep to get started on the work day, and when attempting to place my cursor into a field into which I was going to input some text, I would all of a sudden see a series of f's or dashes which are the hot keys for my summoner spells.  This signified a stuck axis (the device is always connected via USB, sitting on my desk, and ready for me to jump into que for a battle on Summoner’s Rift).  There was nothing I was ever able to do to get the single dead axis to revive.  But each time this would happen, the next day, the axis would be unstuck without me doing anything, as if the sun rising on a new day had some effect, and it would work perfectly again.

It was for this reason that I requested two more old-style mods from W11cE which would allow me to discard the intermittently failing but often working 4th new style mod, and would give me a total of three old-style mods which I still believe are the more reliable of the two types.

For whatever reason, I have not observed single axis death for any days during the past five or six weeks on the 4th old style mod that continues to be in use.  Therefore, I have elected to finish the device with that mod remaining in place as well as implementing the recently received working old-style mod.

Please see below the pick of the new style mod in place facilitating use of the second analog stick.  You can see that I have recently cut channels for the wires.

[attach=1]
[attach=2]
I have just now this evening made this section permanent as seen below with clay filling and a sugru shell.

[attach=3]
If the new style mod fails again in any fashion other than an intermittence periodic single day death, perhaps I will ask to trouble W11cE for a production run of one or two more old style mods next year.  For now, I want to give that dude a break from this tricky work with my gratitude :-*

There is now a new ergonomic issue that I must address with the device.  I mentioned some time ago that I plan to swap out the springs in the outside leg switches in order to make them easier to actuate.  Given that our fingers probably have something like 20 to 50 times more strength when pulling than when extending, I have always thought that reduced actuation force in the outside keys leg is an obvious and ultimately necessary consideration.

As it turns out, I actually experienced a bit of a physical problem earlier this week in my index and middle finger knuckles at the base of my fingers from hitting those outside keys.  I experienced some pain that was clearly the result of hitting the outside keys and has already completely gone away after not playing for 48 hours or so.

It’s not an RSI, is just one of those temporary aches that come along and go away pretty quickly as long as they are well respected.  These kinds of pains are perhaps a predecessor to RSI.

At any rate, I have done a research project and made a project plan to replace the springs with the 45 g ones found here when they are back in stock:

https://www.originativeco.com/collections/accessories/products/springs?variant=10816882565

I also plan to follow the tutorials on how to lubricate cherry switches.  Hopefully by taking down the required actuation force by quite a bit, I will be able to continue using the device with its current design.  I really hope so, because performance is just outrageously brilliant.  I’m back on the ranked team and am enjoying it immensely.

Also in the coming weeks I look forward to implementing the third analog stick.  Doing so will eliminate the need to access items in game with an alt key map which has been a significant limitation to my game mechanics :thumb:


Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 04 May 2016, 09:57:47
Hey guys, got a pretty good update for us :cool:

The cost of the planned upgrade to springs and lubrication for the outside leg keys is $41.  I put off purchasing the items due to the significant expense, but have just now finally placed the orders.  I went with the 35 g springs from mechanical keyboards.com and the GH recommended DuPont silicone Teflon lubricant.  These items were not cheap.

I have recently excavated the area into which the third analog stick hardware will be placed.
[attach=1]
and have begun preparing the hardware for installation...
[attach=2]
[attach=3]
And I have settled on placement of the third analog stick in terms of positioning and tilt as follows...
[attach=4]
[attach=5]
[attach=6]


As you can see, the third analog stick sits a bit higher than the primary stick, which is not optimal.  I have chosen to accept this design flaw for a couple reasons. 

First, The third analog stick is only used for items which require access probably once every couple of minutes unlike the primary camera stick which is essentially used continuously throughout the 40 minute matches.  The third stick is perfectly accessible without strain despite the fact that it would probably be a bit better were I to have been able to position it a quarter-inch lower or so.

Second, and perhaps more importantly, the work required in order to position the third analog stick lower (or deeper, depending on how you think about it) such that it is in line with the placement of the primary stick would require unearthing of the mod for the primary stick.  Each time any work is done in, around, or upon one of the mods, there is the chance it will suffer trauma and break.  This risk is significant, and I choose to avoid it whenever possible.

At any rate, I have done some brief ergonomics testing with the third analog stick positioned as pictured, and it will do quite nicely.

Other related activities and thoughts are as follows.  I have begun the work of risk management for the device.

The first consideration is how to insure the device.  I will be doing quite a bit of overseas travel if things go well this year, so I will need to find a carrier that will insure the device for upwards of $3000 or so.

I also need to find a crush proof case such as a pelican case.  I'm having trouble finding one that fits well without being very oversized and taking up a wasteful amount of baggage space.

Finally, and perhaps most interestingly, I have conceived of a way to implement PS Vita analog sticks without the need for mods in the event that any of the mods currently in use fail.

Yes, I plan to attempt to solder wired directly onto the PS Vita ribbon cable.  I have read all of the threads explaining how and why doing so is not viable.  I also understand that W11cE's reason for going to the significant trouble of creating the mod solution in the first place was because of the difficulty of this particular soldering job.

However, I have conceived the way to do it.

I'll follow up this post with how I plan to do it.  Have to head out right now ;)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 04 May 2016, 11:12:51
Back.

My experience with PS Vita ribbon cables (yeah i know they're not really ribbon cables, but better described as flat cables) Is different from that of W11Ce's.  He found the ribbon cables on his PS Vita sticks to be fragile and easily broken.  Perhaps the PS Vita sticks he has on hand came from a newer or older production run with different durability properties than the ones I have.

The ones I have are extremely durable.  I have beaten the sh*t out of them throughout the course of this project and they hold up well.  One of them was even folded to the extent that it has a permanent crease in it.  Regardless, it continues to perform.

From what I have observed, the difficulty in soldering wire onto the teeny tiny pinouts on the ribbon cable has to do with size.  I'm guessing that the materials don't present any problem and that the material in the ribbon cable will adhere to and make a connection with solder.  At least I hope so.

I found an example on one of my HDDs of what I believe to be the same material with wire soldered directly onto it as pictured here...
[attach=1]

The solder I have on hand along with my soldering gun tip are entirely too large to handle the delicate precision work needed to attach solid core wire to the ribbon cable pinouts due to the size issue.

So, if I have need in the future, I plan to attempt to get the job done by cutting in between the ribbon cable pinouts and separate them like fingers.  I have a spiderco dragonfly that's frighteningly sharp which should be able to make that cut.  Otherwise, an X-Acto hobby knife might work as well.

After separating the pinouts of the ribbon cable like fingers, I plan to try to take stranded wire and wrap one finger at a time once or twice around.  Doing so might eliminate the size problem and not require such precision work in order to successfully land a drop of solder where it's needed in order to fuse the stranded wire to one finger of the ribbon cable adequately such that connection is made.

Perhaps this idea is ill-conceived and uninformed.  Hopefully I don't even need to try it :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: vextanys on Wed, 04 May 2016, 11:31:34
Is there any significant difference between the PSVita sticks (mods or not) and these http://www.ebay.co.uk/itm/New-PSP-2-Axis-Analog-Thumb-GAME-Joystick-Module-3V-5V-For-arduino-PSP-CF-/272041589815?hash=item3f56f13c37:g:yS4AAOSw8-tWVXkn ?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 04 May 2016, 13:22:28
yeah, as described in XIM community forums, PSP analog sticks are the ultimate suck.  Put in plain English, PSP sticks are vastly inferior to Vita sticks and cannot be considered as part of a project that's serious about performance along with long-term gaming and injury avoidance.  That's why so much laborious trouble has been undertaken to implement Vita sticks instead of anything else available.  There's just nothing available that compares.  Nothing.  Unfortunately.

Anyway, thanks much for posting.  Any extra attention to this project is extra attention to the aging gamer's cause, and much appreciated :-*
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: vextanys on Thu, 05 May 2016, 04:05:27
Didn't realize the PSP sticks sucked so much :) I haven't got as far as hooking them up to test yet, in my "inspired by this thread but different" project. Sadly I don't think I'd be able to use a PSVita stick due to my skills and budget, so I may have to use the PS2 stick. I'll post a thread with my build when I get past the really bad prototype/breadboard stage :)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Thu, 05 May 2016, 16:40:00
Looking good, the slight height increase should help you not press the nearer stick by mistake.  I laughed at your insurance estimate but thinking about it it's probably fair - it is one of a kind and has taken countless hours to refine.

If you want ideas for a case some dimensions would be good, it looks much thicker than I was imagining it would be...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 07 May 2016, 12:42:53
so I may have to use the PS2 stick.

You don't have height related real estate issues or limitations, you might want to look into implementing xbox one or ps4 analogs.  If I recall correctly from handling I think both of them in a retail big-box store a few years ago, they are both quite nice :cool:

The hardware for them however, is tall :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 07 May 2016, 12:50:28
Looking good, the slight height increase should help you not press the nearer stick by mistake.  I laughed at your insurance estimate but thinking about it it's probably fair - it is one of a kind and has taken countless hours to refine.

yeah i'd basically have to order everything for a workshop, not just the parts for the device itself.  aaaaaaand i'd have to have enough compensation from the loss to take like 2 months off work to remake this motherf***** :'(



If you want ideas for a case some dimensions would be good, it looks much thicker than I was imagining it would be...

right, so it's 13cmx11cmx7cm

All of the crush proof cases I found that accommodate the thickness of the device also happen to be pretty damned long.  Hence, the wastefulness :'(

I'm even trying to come up with other precious items that require such protection to fill the long cases, but not having any luck :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 07 May 2016, 12:55:33
some reference photos for my keycap arrangements ;D
[attach=1]
[attach=2]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 07 May 2016, 13:12:00
So next…

This job was pretty intense and required a two-person surgical team
[attach=1]
[attach=2]

The tool I bought for disassembling switches wasn't able to be used for any of the four switches.
https://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=1363

I thought of cutting the tool pieces in half so they would fit into the application.  But even using pliers to pinch at the base, the tools just don't work at all to open the switches.  The angling achieved from the lengthy handles is necessary.  Therefore, I had to dig out the sides of the switch installations and manually release each latch, shimming, unlatching, and shimming again until one more latch release would get the things open.

Given the the need to access the inside of the switches again in any future revisions such as more spring changes or for doing a re-lubrication, I made a plan to slice the latches off and hold the switches together with the usual approach – clay base plus sugru shell

now i need to find out the right paint brush size to apply the lubricant and place an order :thumb:

i already got the teflon silicon :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 09 May 2016, 19:18:48
springs and lubrication project is complete :thumb:

after what i'm guessing was almost 3 weeks, i was able to squeeze a game in last night and went 22/8/24 (hard carried) with the new dragon champion Aurelion Sol.  gotta love it ;D

outside leg keys are a lot easier to depress.  now i want to do this to my whole rosewill entry level mechanical keyboard with the colossal design fail of plate mount with no ability to remove the key tops without either desoldering everything (not gonna happen), or drilling out the plate clearance for each key to release its death-grip on the tops.  sandwich this you mass producing disposable lifestyle perpetuating a**hats >:D

I cleaned up the top of the device by disconnecting, trimming, restripping, and re-laying all of the wiring there in preparation for implementation of the final component - the third analog stick.

It may not look like it, but the new wiring assembly pictured below is much more flat, low-profile, compacted and ready for covering without any overly large or bulbous section needed to house the top wires now compared with what has been in place for probably over 90 days.  That was a bit of a birds nest of wires ^-^

[attach=1]
[attach=2]
[attach=3]
[attach=4]

Hopefully, true finalization of the device is coming soon.

The device is still pretty ugly, but it could've been worse and I'm very happy with it :thumb:

When it's really done, I'll do a proper high-rise photo shoot along with something like a 360° video :cool:


Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 11 May 2016, 15:07:41
august 13th, 2015.  wow, nearly a year to reach this point.  another hard day of work on the device, and it's all but complete :thumb: 

i just have to cover the wire assembly on top and the yellow analog wires, and i think the device really is finished :))
[attach=1]
[attach=2]


so yeah, 3rd analog is in place and working.  after so much toil and perseverance, and months, and money (i swear this thing cost $400 or more even though i didn't keep a strict tally)... i'm somewhat astounded to see all 3 analogs working and mapped for supreme league of legends control :cool:

[attach=3]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Wed, 11 May 2016, 17:43:50
What's with that Xpadder layout, two rows of four keys too sane?  Glad to hear it's all working though, I guess you'll be off round the world playing games soon!

Looking at cases the smallest I found was this one (http://www.casesbysource.com/product/sliding-latch-case-sl-754) but it has no padding or handle, this one (http://www.opticsplanet.com/pelican-protector-small-case-1120.html?_iv_code=PE-DX-1120small-1120-000-110) and this one (http://www.opticsplanet.com/skb-cases-iseries-0705-3-waterproof-utility-case-8-36x6-7x3-83in.html?_iv_code=Q8-DX-SKB07053-3i-0705-3B-C) are a bit bigger all round but have foam, handles (and the first one is available in orange so it must be good :)))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 11 May 2016, 19:19:50
oh hell yeah i never saw that orange one before

yeah, it's orange so it must be good :thumb:  just ordered it :))
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: sinusoid on Fri, 13 May 2016, 06:53:36
Mmmm... This thing brings back memories...  :))

[attachimg=1]

I'm enjoying the build process a lot. Sugru really shines as a prototyping material here I think, when you make a working device that can both withstand regular use and still maintain modifiability.

Also, an organic design developed through a kind of an evolutionary process, I love that a lot! :D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 13 May 2016, 18:02:18
oh wow, i never had a reason to look and see what bungie's 1st game was like.  sorry i missed that one as i was strictly on consoles in tha nine 'fo ^-^

so the device looks like that gun in the game eh?  if it's a gun made of alien genitals, then i'd guess they're similar looking indeed :))

oh yeah, sugru is outstanding for this kind of thing especially with the clay base.  to modify, you just have to make shallow cut, peel off the sugru shell, and start digging out and reshaping whatever :cool:

Another note about the Sugru and Clay combination.  It does in fact make for a durable structure.  Although Clay can be soft and squishy, as it's designed to be, when Clay is backed up against another material or just up against more clay, it becomes very strong and solid.

My device can be grabbed firmly without much worry and even dropped although I haven't done so yet and hope not to :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 16 May 2016, 13:20:55
high rez photo shoot and action videos.

My sugru work became more sloppy in the end as i had large areas to cover and have need to move on with other of life's projects  ;D

let me know if this page is loading too slow due to the high rez photos and if there's any method i should use to improve it.  i chose the usual 'inline expandable thumbnail'

[attach=1]

[attach=2]

[attach=3]

[attach=4]

[attach=5]

[attach=6]

[attach=7]

[attach=8]



[attach=10]

[attach=11]

[attach=12]

[attach=13]

[attach=14]

[attach=15]



Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Mon, 16 May 2016, 17:16:25
Seems your measurements were a little off, the case could have been smaller.  It looks suspiciously red too...

Seriesly though that looks perfect in your hand and well deserving of a big cosy box to live in.  I hope it brings you many hours of pain free gaming :thumb:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 16 May 2016, 17:29:50
lol, thanks Orange, your support and good humor has been great this whole trip :-*

Yeah, why does the box and my spiderco dragonfly look so darned red these pics? :-X

They are both bright orange IRL :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 03 June 2016, 14:33:19
Hey guys, got a pretty cool update :cool:

After installing 35gm Springs and lubricating the switches on the outside keys leg, I found the need for even less actuation force.

I actually severed off around 25% of the length of the Springs.

Users who have switched out Springs to lower than stock have reported mushy performance.

I cannot disagree with their findings.  Certainly, the responsiveness of the keys is greatly reduced.

However, I have brought down the actuation force and required amount of travel to practically nothing.  For my usage case, this change is extremely desirable.

Now, the red switch piece actually sags into the housing of the switch due to the shortened spring and actually resides just above the point of actuation.  The required distance to travel in order such that the switch is activated is so little and requires so little force, that essentially just brushing the outside keys with the backs of my fingers activates them.  I could not be more thrilled with this kind of performance

As anyone who has read this thread knows, combat performances certainly important to me.  However, of primary importance is my ability to continue playing the wonderful game league of legends injury free for the foreseeable future.

Prior to implementing the new springs in the switches, I was already starting to experience potential future injury issues from hitting the outside keys with the backs of my fingers due to my age and the natural limitations of the human hand.  At this point, hitting the outside leg keys requires little more actuation force than just lifting my naked fingers.

Also, when it comes to the outside keys, I don't need super amazing responsiveness.  The functions mapped to those keys are not directly for combat.   one of them is my alt keymap key.  One of them is left mouse click, one of them is for pings, and one of them is the return to base or back key.  None of these require double tapping or any kind of rapidfire activity.


In other news, I have recently lost one axis on the analog stick that employs the new type mod from W11cE.  You can see the stuck axis here:

[attach=1]

Fortunately, I still have enough functionality to be able to play the game without significant compromises such as having critical in-game actions only available on alt key maps.

Still, having the crippled analog stick working again is highly desirable because it gives me the chance to have a wider array of items with so-called active functions (items that don't just give you armor, but also have an ability built in that slows enemies or something on activation ).

I therefore would like to move forward with my plan to try soldering stranded cable directly onto the fingers (pinouts) of the PS vita flat cable.

I have recently sent a message to W11cE asking if he by chance knows what the pinouts are for this particular PS Vita 2000 analog stick that has fewer pins than the original PS Vita analog stick.  Just 4 instead of however many, I guess six, on the original.

I hope to be able to solder stranded cable directly onto the pinouts of this analog's flat cable:

http://www.amazon.com/Black-Analog-Joystick-Control-Stick/dp/B01DG4DXNC?ie=UTF8&colid=3P81QSPM8JCMR&coliid=I3RGJM7C1JQSRO&ref_=wl_it_dp_o_pC_S_ttl

I'm wondering if I can get anyone to chime in on the theory behind this plan.  It is as follows.  It is only necessary to achieve connection between the pinouts on the PS vita flat cable and the teensy board.  It doesn't matter how the connection is made, as long as it's clean.  The mods made by W11cE simply achieve this necessary condition.  There is no other functionality or anything else taking place in the mods.  They simply create an electrical connection between two points.  There isn't anything like resistors or capacitors or anything else working in there.  Does this sound right to you guys?

I have a teensy board and the PS Vita 2000 analog stick on my Amazon wish list and am planning on an experimentation project with those pieces to try to get them connected and working sometime in the next 60 days.  Working on this particular experiment separate from the controller using newly purchased components is desirable because revisions require demolition and teardown activities followed by reforming which puts me out-of-game for as long as a week at a time (and can result in damage to existing working mods) :-X

And even other news, I recently got pretty involved with the steam controller.  I plan to take a break from league for at least one week out of every month to rest my hands.  Regardless of how forgiving my controller device is, it's wise to switch things up as much as possible.

My steam controller is out for repair because I spilled a full glass of water onto it that miraculously managed to empty its entire contents directly into the face of the controller and a great deal of water went into the spaces around the buttons and such filling the controller.  My steam controller was temporarily able to be used as a water dispensing container :-[

At any rate, I'm happy to report for anyone searching for low-impact gaming options that the steam controller using gamermuscle's Config that employees both the right trackpad and the accelerometers for pointer control together along with various other config tweaks I have made results in what is surely the lowest impact gamepad style gaming experience available.  I got started with Paragon from epic games, and also plan to purchase overwatch.

anyway, thanks as always for reading ;D
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hanya on Sat, 04 June 2016, 01:30:41
I have recently sent a message to W11cE asking if he by chance knows what the pinouts are for this particular PS Vita 2000 analog stick that has fewer pins than the original PS Vita analog stick.  Just 4 instead of however many, I guess six, on the original.
It's different from PS Vita 1000, see:
http://www.alps.com/prod/info/E/HTML/MultiControl/Potentiometer/RKJXY/RKJXY1000006.html
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 06 June 2016, 15:35:50
thanks hanya :D

いつも手伝って頂いて有難う!
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Wed, 22 June 2016, 12:34:29
Hi guys, I received the ps vita 2000 analog stick, and the required actuation force is so much higher than the ps vita 1000 analog stick that I'm just left disappointed and shaking my head :(

I will need to attempt to do the direct soldering job on the ps vita 1000 analog flat cable pinouts, which will be more difficult but appears to be something I can handle.  Can I trouble somebody to please tell me the pinouts for the ps vita 1000 analog ?

I know that I should be able to guess what they are from reviewing W11cE's original tutorial on XIM forum, but it would be nice if I could get confirmation of exactly which of the pins must be combined for power along with what the other pins are for before I start cutting and soldering the flat cable :-*
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 23 June 2016, 15:40:54
Hey guys, I just remembered that I need to present a diagram with my question about the pinouts so that we don't end up with an orientation miscommunication :-X

Can someone please let me know what 1 through 6 are for?

[attach=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Thu, 23 June 2016, 17:37:37
Using W11cE's pic this is the order, assuming your connector is pictured with the stick bent to the left at the top of the cable.  I'm also assuming it's 5v but if you're running the others on 3.3v go with that.

(https://drive.google.com/uc?id=0B_0MQrj9_eGtRFNCc09iWjN2TFE)

1 - GND
2 - X
3 - Y
4 - 5v
5 - [empty]
6 - 5v

There's speculation here (http://modretro.com/xen/index.php?threads/ps-vita-psp-go-analog-stick-pinout.13568/) that [empty] should be a second GND and it is pictured as going into the stick so should probably be something...
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 23 June 2016, 17:53:20
Oh yeah, I shouldn't have made the pic so small.  Here's a better version

[attach=1]

Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Thu, 23 June 2016, 17:56:17


There's speculation here (http://modretro.com/xen/index.php?threads/ps-vita-psp-go-analog-stick-pinout.13568/) that [empty] should be a second GND and it is pictured as going into the stick so should probably be something...

I've seen that post a few times, probably going back as far as months ago.  It seems to not have any real answer to what the actual pinout is.

I'll probably end up pestering Hanya or W11Ce for the answer with PMs if one of them doesn't pop in here within a week or so.  I don't want to start cutting and soldering without hearing from one of them ^-^
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Fri, 24 June 2016, 10:18:42
Using W11cE's pic this is the order, assuming your connector is pictured with the stick bent to the left at the top of the cable.  I'm also assuming it's 5v but if you're running the others on 3.3v go with that.

Show Image
(https://drive.google.com/uc?id=0B_0MQrj9_eGtRFNCc09iWjN2TFE)


1 - GND
2 - X
3 - Y
4 - 5v
5 - [empty]
6 - 5v

There's speculation here (http://modretro.com/xen/index.php?threads/ps-vita-psp-go-analog-stick-pinout.13568/) that [empty] should be a second GND and it is pictured as going into the stick so should probably be something...

Almost:
1 - GND
2 - X
3 - Y
4 - 5v
5 - 5v
6 - 5v

The small trace goes to pin 5 under the connector.

Wouldn't even say speculation. More like just a guess.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 24 June 2016, 10:21:43


Almost:
1 - GND
2 - X
3 - Y
4 - 5v
5 - 5v
6 - 5v

The small trace goes to pin 5 under the connector.

Wouldn't even say speculation. More like just a guess.

fabulous, thank you :-*
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: suicidal_orange on Fri, 24 June 2016, 12:01:37
Using W11cE's pic this is the order, assuming your connector is pictured with the stick bent to the left at the top of the cable.  I'm also assuming it's 5v but if you're running the others on 3.3v go with that.

Show Image
(https://drive.google.com/uc?id=0B_0MQrj9_eGtRFNCc09iWjN2TFE)


1 - GND
2 - X
3 - Y
4 - 5v
5 - [empty]
6 - 5v

There's speculation here (http://modretro.com/xen/index.php?threads/ps-vita-psp-go-analog-stick-pinout.13568/) that [empty] should be a second GND and it is pictured as going into the stick so should probably be something...

Almost:
1 - GND
2 - X
3 - Y
4 - 5v
5 - 5v
6 - 5v

The small trace goes to pin 5 under the connector.

Wouldn't even say speculation. More like just a guess.

Thanks!  Don't suppose you could make the pins in the pic in your guide the same colour as the traces they connect to so it's obvious?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 26 June 2016, 10:38:38
Hey guys, I got it on the first try :p

Here's the step-by-step process:
First, make the cuts with wire cutters
[attach=1]

Next, change soldering iron tip to a very small and pointy one
[attach=3]

Next, set up the two pieces to be joined on a piece of clay to hold them in place
[attach=2]

Next, lamely poke around with soldering iron and solder until the moment when for whatever strange reason (i'm always facinated how soldering seems to work after a while of poking at something) the two pieces snap together like magnets and fuse
[attach=4]

After the first wire is connected, cover the connection in gel cyanoacrylate like this found here in the states and probably elsewhere

https://www.amazon.com/gp/product/B003Y49R7G/ref=oh_aui_search_detailpage?ie=UTF8&psc=1

Wait two hours or so for the glue to dry enough so that it's no longer tacky.  Solder the next connection by repeating the same clumsy fumbling poke around and cover with glue.  When gluing, put enough glue to attach the first set of connections to the second.  Repeat for connections three and four until you get a cluster of connections covered in glue.

[attach=5]
[attach=6]

Next, connect to teensy and then PC while holding breath and praying.  Mine worked 1st time ;D  If failure, buy another vita analog stick and try again.  they're only about 10 dollars ;)

I'll cover the entire assembly with sugru in the coming days to entomb the assembly as I always do with these jobs to make it shockproof, and largely crush proof and bend proof :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 26 June 2016, 15:57:56
mah next project ;D


https://geekhack.org/index.php?topic=83060.0
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: W11cE on Sun, 26 June 2016, 16:44:15
Nice work with the soldering  :thumb:
I wouldn't have ever believed you can solder that thick wires without breaking the ribbon cable.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Tue, 12 July 2016, 17:54:39
hey can any of you guys do me a favor and tell me where i can buy the black plugs i'm looking for pictured at the end of this post?

https://geekhack.org/index.php?topic=83060.msg2217124#msg2217124
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 18 July 2016, 00:21:15
the 3rd vita analog on the unreliable mod had 1 axis die 60 days back followed by death of the other axis friday evening.

once again, the clay base with sugru shell pays off.  just make a cut or 2, peel off the sugru, and go digging for about 20 minutes.

[attach=1]

[attach=2]
in one long work session saturday (maybe 3 hours), i replaced the bad mod with my recent direct flat cable soldered one and played league saturday night. 

i sure am glad i had already put together that new vita mod soldering job a few weeks back :-X
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 18 July 2016, 00:28:07
i've still got Esc, dance, laugh, and mastery flare on an alt keymap :mad:

there's still room for one more analog stick closer to the base of my thumb.

someday... :cool:
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Fri, 09 September 2016, 17:35:42
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: specializationisoverrated on Mon, 15 May 2017, 22:30:22
I know this is a super old thread but just wanted to thank all of you. I've been meaning to use the PSVITA sticks in one of my own builds and the pinout and info in this thread has been invaluable. Here's a pic of my own breakout. Its straight from a cellphone in bad lighting but I'm super stoked that this worked!

[attachimg=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 15 May 2017, 22:42:59
very nice solution :)

that cellphone part might looks like a good option. where did you get it?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: specializationisoverrated on Tue, 16 May 2017, 20:14:20
Sorry, posted too late last night. What I meant was the pic was straight from a cellphone and thus the crappy picture quality. :) I drew up the circuit board and made the pcb through OSHPark. I soldered on the connector myself.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: vextanys on Thu, 18 May 2017, 03:43:47
Part info about the socket would be nice - I tried to find something but had no idea which of the parts I found would fit (and wasn't confidant that I could solder the thing anyway)
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: specializationisoverrated on Thu, 18 May 2017, 23:10:58
Got the connector from the 1st page of this thread:

http://www.mouser.com/ProductDetail/AVX/046277006001883+/?qs=%2fha2pyFadugU9ExvltPLtf03k1mhZoZgBfiT04U%252bjLiCwPsLFCj2Qw%3d%3d
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: ndstudio on Fri, 26 May 2017, 09:59:31
I have been following this PS Vita Analog stick mod for a bit and finally tried to give it a stab but for some reason when I wire everything up all I get are random values with the Teensy LC that I'm using. Ive tried different connectors and techniques and have tried different arduino test sketches but its always the same. Any ideas??

Currently using:

1 - GND
2 - X
3 - Y
4 - 5v
5 - 5v
6 - 5v
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: ndstudio on Tue, 30 May 2017, 08:01:16
I have been following this PS Vita Analog stick mod for a bit and finally tried to give it a stab but for some reason when I wire everything up all I get are random values with the Teensy LC that I'm using. Ive tried different connectors and techniques and have tried different arduino test sketches but its always the same. Any ideas??

Currently using:

1 - GND
2 - X
3 - Y
4 - 5v
5 - 5v
6 - 5v

Never mind, I tried the splicing technique above and it worked great. I think my issue was that using a socket connector either wasn't soldered correctly or the connection was too weak.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sun, 17 January 2021, 12:11:17
just dropping this pic in here as a reference[attachimg=1]
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: doublethink665 on Fri, 22 January 2021, 23:40:28
Thank you!
This project looks awesome.
I made my own controller using a leonardo years ago and I used the lame arduino joysticks, which work, but are not great. I'm going to revisit it and learn from your example. I'm going to get some sugru, too. Right now I just have parts wired to a prototyping board and I hold the board. sugru will help a lot.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: hanya on Sat, 23 January 2021, 00:45:33
RKJXY joystick has been marked as not recommended for new designs by the manufacturer.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Sat, 23 January 2021, 11:24:29
RKJXY joystick is absolute trash. But the pinout is the same as the good ones. And there are no pics of the pinouts of the good ones.
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 29 March 2021, 19:36:46
Hanya, do you know where to buy the plug in the picture above?

Or do you know of any similar product that the newer PSV 2000 cables can be connected to?
Title: Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
Post by: Camineet on Mon, 29 March 2021, 20:17:41
Nevermind, I found some threads on sudomod with a lot of good info

https://sudomod.com/forum/viewtopic.php?f=44&t=5363&start=20

https://sudomod.com/forum/viewtopic.php?t=3485