Jump to content

an Arduino USB HID controller, composite USB controller


overpro

Recommended Posts

I use this on/off switch.Have 2 pols.I connect it on pin 38 and 41.When it is in On position lights the 99 button if i remember well.But in the game must return to Off position to execute the command.Can this type of switches works with Joystick?.I want to ON the headlights.

Thank you for help!

 

5d5d294dc5716c4075519324a1486a94.jpg

 

Send from my mobile


Edited by Maximvs
Link to comment
Share on other sites

I use this on/off switch.Have 2 pols.I connect it on pin 38 and 41.When it is in On position lights the 99 button if i remember well.But in the game must return to Off position to execute the command.Can this type of switches works with Joystick?.I want to ON the headlights.

Thank you for help!

 

5d5d294dc5716c4075519324a1486a94.jpg

 

Send from my mobile

 

Is it DCSW A10C or something else? if the game only recognize the edge triggered signals instead of level triggered signal then the arduino code need some rework.

 

the current arduino code only works as level triggered:flip to On always make the button as On.

There are other types such as rising edge triggered: flip from off to on will generate a Button On pulse, falling edge triggered: flip from on to off will generate a Button On pulse, rising/falling edge triggered: flip from off to on or on to off will both generate a pulse.

 

Refer to post #99 to rewrite the button logic if you want to implement edge triggered type.

http://forums.eagle.ru/showpost.php?p=2299483&postcount=99

 

I 'm confused on the last question, I think we are talking about the joystick right now. So what do you mean by “using this toggle switch with Joystick”?

overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro

Link to comment
Share on other sites

For the last question i mean if this ON/OFF switch can work with your joystick code.

 

This is not a toggle switch.Is just ON - OFF position and as i can think it's not generate a pulse,right?I can't rework the code cause i don't know how to do it Overpro.

Thank you for your answer and i will use a toggle switch with ON-OFF-ON positions.I use this and works perfect.


Edited by Maximvs
Link to comment
Share on other sites

I think you got the definition of "toggle" wrong. It has nothing to do with sending a pulse.

For the last question i mean if this ON/OFF switch can work with your joystick code.

 

This is not a toggle switch.Is just ON - OFF position and as i can think it's not generate a pulse,right?

Link to comment
Share on other sites

sorry....you are right!...i mean that the toggle switch goes to ON and return to OFF , so the command is ok....this switch that i try do the "half" of the command....must goes from ON to OFF manually,so i can't use it....if there is a solution i will be glad to tell me.

Link to comment
Share on other sites

Ah, ok. I see you mean a momentary switch. I'm not familiar with the Arduino HID controller, but I guess it's similar to Leo Bodnar's BU0836A. When you use a momentary switch, in Windows game controlers screen you can see a button turn on. You let go of the switch and it goes off.

 

In some controllers (I use PHCC) you can specify a command when an input is On, and a different command when it goes Off. In BU0836 (And I guess Arduino HID, since you're having that problem) you can't do that.

 

You can, however, use software to do that. I've go to look in my bookmarks, but I remember at least two apps where you could write a scrip that e.g. sends a keyboard command when a joystick button goes on and a different when it goes off.

 

HTH

 

sorry....you are right!...i mean that the toggle switch goes to ON and return to OFF , so the command is ok....this switch that i try do the "half" of the command....must goes from ON to OFF manually,so i can't use it....if there is a solution i will be glad to tell me.
Link to comment
Share on other sites

  • 1 month later...

Wanted to share my pain in connecting the ARDUINO 16U2 chip to the USBASB (usbasp thomas fischl) in order to flash the firmware. If you look at that device you will find the proper pin out http://www.dx.com/p/10-pin-to-6-pin-adapter-board-for-avrisp-usbasp-stk500-black-blue-225135 and you will be able to match it to the board http://forum.arduino.cc/index.php?topic=125908.0

 

When trying to communicate using AVRDUDE (under linux or windows) you will have a message like "USB ASP firmware needs to be updated" = False, it is most probably because the wiring is incorrect (10 to 6 pins)


Edited by TripleSeven
Link to comment
Share on other sites

  • 2 weeks later...

Good day,

For those willing to use only 32 buttons (pin 22 to 53) I ve made some more compact code.

You need to use momentary switch or ON OFF switches, OFF = closed circuit, ON = open circuit (used the internal pull up). Debounce is done by the driver so no need to change code for that.

 

You need to perform steps as described at the beginning of the post and my previous post if you need to reprogramm the 16U2 because mine refused to go into DFU mode.

 

I m building a panel for the Su-27 with engine start/stop, avionics, autopilot, ECM with corresponding LEDs. More code to come.

 

Note that the original code is not compliant with most of the software best practices and it needs to be reworked but at least it is cleaner.

 

Have fun.

JoystickGrand.zip


Edited by TripleSeven
Link to comment
Share on other sites

  • 1 month later...
The easiest way for switches is to 'cheat' by using a 2pol. switch.

 

For buttons it would be a little more tricky. Something with Flip-Flop pops up in my mind. But that must not be the best solution.

 

yes....very clever trick !!....i want for On-Off switches....i try it!!...thank you!!

Link to comment
Share on other sites

analog mini joystick

 

Hi to all and a big thanks to overpro for this great solution for a button box. Came across this yesterday and have managed to suss out the matrix and have got a button and a rotary encoder working without problems. I have tried a mini joystick on the analog ports but the vertical pot seems to be faulty so have ordered another. It comes with v+, Keypush (button,) vertical, horizontal, and gnd pins which is straight forward but how would I share the gnd with the button when using it in the matrix? I also have a pcb mounted encoder with button which also shares a single gnd. Hope my question is clear and many thanks in advance for a solution.

intel i7 6700k overclocked to 4.6, 16GB DDR4 3200MHz, Asus z170 pro gaming motherboard, Asus strix 1080, Max flight stick(modded), MFG Crosswind pedals.

Link to comment
Share on other sites

Thumb stick

 

As an update to my last post I have now received a new thumb stick which seems to work ok though i'm still having trouble getting the select button to work properly. When the button is depressed i'm getting what seems to be the first button of each matrix row light, ie: 1, 17, 33, 49 etc.. Any help on this would be appreciated.

 

rsz_1button_pressed.png.befbc7876b7c8d3f61683dfc21aabb0a.png

intel i7 6700k overclocked to 4.6, 16GB DDR4 3200MHz, Asus z170 pro gaming motherboard, Asus strix 1080, Max flight stick(modded), MFG Crosswind pedals.

Link to comment
Share on other sites

Thanks DSP. I'll have a proper look tomorrow. Looking at the matrix diagram, am I right in thinking that the column (38) will have the diode in which the cathode will go to the gnd wire of the switch (which will also be to gnd on the arduino as the thumb stick needs the gnd) and the row (28) will have a direct connection to the select wire of the switch?

intel i7 6700k overclocked to 4.6, 16GB DDR4 3200MHz, Asus z170 pro gaming motherboard, Asus strix 1080, Max flight stick(modded), MFG Crosswind pedals.

Link to comment
Share on other sites

I'm still getting ghosting. The problem seems to be is that the thumb stick needs the gnd wire to have a connection to gnd to work which then just leaves the one wire (select) to connect to the matrix. so I have row(pin 28) connected to the select wire, which is then connected via a diode to the column(pin 42). The cathode of the diode is towards the switch. If I reverse the diode I get nothing.

 

rsz_thumbstickv2.png.4899fb3ba88a13c6612927a5d8d89cb9.png


Edited by kuabi
Added diagram

intel i7 6700k overclocked to 4.6, 16GB DDR4 3200MHz, Asus z170 pro gaming motherboard, Asus strix 1080, Max flight stick(modded), MFG Crosswind pedals.

Link to comment
Share on other sites

The button matrix won't work (properly) if there's a ground connection.

 

To make the button work you need to cut the ground connection to the button on the PCB (i.g. the button is isolated from the pots). Then you can connect it to the row and column pins (don't forget the diode) and everything should work as expected.

 

DSP

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...