Menu

Using joy2cmd

Keith
2009-03-03
2013-04-19
  • Keith

    Keith - 2009-03-03

    I checked this out and joy2cmd looks like what I want to do some home automation work.

    I'm a sourceforge newbie and c++ illiterate.  so please forgive me.

    I have all of the windows and doors in my house outfitted with magnetic closure sensors (switches).  I have 20 of them.  I'm using the GroovyGameGear GPWiz-40 USB control input unit.  It comes up as /dev/input/js0.  The joystick test application - jstest - shows the 32 button inputs.  Nice.  I will hook up the magnetic switches to those button inputs.

    joy2cmd works great out of the box, however, I want to detect button change state (button press and button unpress) and execute a command at each transition.  I'm C++ illiterate, but I hacked at the code and compiled and did some work, but I quickly get lost in the structs and pointers to try to insert a state transition detection.

    I'll work at it some more, or if you have some suggestions, please let me know and I'll see if I can work it some and learn some C++ at the same time.

    Thanks for the "Cat's meow".

    Keith

     
    • Christian Landel

      Hi!

      Nice to see interest in my little prog.

      I'm a SF newbie as well, that's why I only noticed now there is a post in my project forum (it's been more than a week... I'm used to getting e-Mails for stuff like this).

      I will implement the execute-on-release feature in a few hours ;) it will work like right now for button release (bx "cmd blah"), and on press it will be Bx "cmd etc". I was unsure at first if the commands should be executed when a button is pressed or released, but now that's solved.

      I never thought of learning programming languages by hacking small projects, maybe I should try it too. I'm not very skilled with C++ at the moment as well, so don't think of the code as of a masterpiece (although I try to make it in a common style).

      Well, let's see what this project brings, maybe there will even be a GUI at some point, and a more direct access to game devices (not just via SDL).

       

Log in to post a comment.