Shop OBEX P1 Docs P2 Docs Learn Events
Input Interface — Parallax Forums

Input Interface

HandtoolHandtool Posts: 17
edited 2007-02-18 02:45 in Robotics
Howdy Folks,

This is my first post on the boards here and as might be expected I'm a noob to the programming world, so please be gentle.

I'm working on a school project involving a Boebot (BS2)·and the EB500 module.· Thanks to all the info here and the parallax website it is working great using hyperterminal to·output keystrokes to the stamp for servo control.· The next step in the project is to take inputs from a usb joystick or mouse and output those to the stamp to control the movement of the·boebot.

I don't know what I don't know so I'll just throw out some random questions--
Is this something that can be done through software alone or is there a hardware piece needed?· Where should I begin with the software interface?· Is there currently a product available that will handle this or do I need a crach course in -- C++, VisualBasic, Java, others?· I have no experience with any of these so I need to know what will do the job with the smallest learning curve. · I hope to run this on a laptop with XP.

Thanks!

Dusty·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-17 22:24
    I'm assuming that you want to attach a USB joystick or mouse to the BOE.

    To attach anything USB to a Stamp requires some hardware to do it (act like a host (computer) to a USB device). One such device is the Vinculum made by FTDI. Currently this is sold as something called a VDIP1 which is a 24 pin DIP-like package. It talks via SERIN/SEROUT to the Stamp and can talk at a low level with any USB HID (Human Interface Device) like a mouse or joystick. The trouble is that it talks to the registers in the device and those may not be well documented. There doesn't seem to be a standard.

    Another similar device is the USBwiz by GHI Electronics. This also can be hooked up to a Stamp via SERIN/SEROUT and can talk to HID class devices. It has more complete documentation than the Vinculum and may be easier to use with HID class devices (like a joystick).

    I'd suggest downloading the documentation from both www.vinculum.com/index.html and www.ghielectronics.com/ and see which seems easier to understand. They're similar prices (about $50-60) and both also provide access to SD cards and USB flash drives.
  • HandtoolHandtool Posts: 17
    edited 2007-02-18 01:37
    Thanks for the reply Mike.

    The goal of the project is to plug a usb joystick into a laptop and control a Boebot with it over the bluetooth wireless connection.· So I guess I am looking for the means to take the input from the joystick, whatever it is, turn it into something the stamp can deal with and output it to a com port where the bluetooth dongle lives.· I thought this could be done by·creating some sort of GUI, but again I have no experience with that so I'm looking for someone to tell me either I'm on crack and it can't be done·or I need to look into xyz program or just generally drop kick me in the right direction.
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-18 02:45
    If you are planning to use a Gameport device - this is the pinout

    http://www.technick.net/public/code/cp_dpage.php?aiocp_dp=pinconjoy_pc_game

    and here is a link to Visual basic routines to use this port

    http://www.pages.drexel.edu/~kws23/tutorials/joyWin/joyWin.html


    Once this is mastered you can send data via serial port to a device like this
    http://www.kanda.com/index.php3?cs=1&bc=direct&bw=/serial-wireless.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'
  • John R.John R. Posts: 1,376
    edited 2007-02-18 02:45
    Handtool;

    Assuming you have/can get the serial communication working between the PC and Stamp, then yes, you can get a joystick to steer the BOE bot.

    Depending on what version of the development tools (VB6, C#, VB.NET) exactly how you do this will be different.

    In C# and VB.NET (e.g. Visual Studio 2003 or newer), you use DirectX to get at the joystick. I'm not sure how you get at the joystick in VB6 (or other COM interfaces).

    I'd bypass the joystick to start with. It's an extra layer of complexity you don't need to start with, and it can be added latter. You won't "loose" or "waste" any of the work you do leading up to there. The Joystick will just be another "trigger" what you have done alread.

    I'd suggest starting with a user interface in what ever software you're going to use.

    Put at least 6 buttons on the screen. Five should be in a "cross", and one more off to the side.

    The cross should be something like this:

    [noparse][[/noparse]code]

    [noparse][[/noparse]Foward]

    [noparse][[/noparse]Left] [noparse][[/noparse]Stop] [noparse][[/noparse]Right]

    [noparse][[/noparse]Reverse]
    [noparse][[/noparse]/clode]

    The sixth (or more) buttons are for controlling the communications (Open Connection, Close Connection, etc.) You may also need a "combo box" or something to select the port.

    Then start to program the software to open the communication port (I haven't even looked at the EB500, so I can't help much. If you access it (the STAMP) through hyperterm and a "Virutal Serial Port", you'll be able to do the same thing in the software.

    Program each button so that when you press the button, you send out the appropriate serial commands to the BOE Bot. As a hint for the next steps, don't write the actual code for sending the commands in the button "OnPress" event. Have that event call one or more other functions that are "stand alone".

    Once you have this all working, then you can look at how to process mouse movement, and/or the input from a joystick. Then you "just" process the inputs from the mouse or joystick and based on the values, call the appropriate function(s) you called when you pressed the buttons (This is why I said "don't write the actual code for sending the commands in the button "OnPress" event.)

    I've done this, and used input from a joystick, as well as other windows controls, and if you break things down "one step at a time" it isn't all that hard.

    What ever software you use to write the interface, there should be some examples avaialable to show how to open, send and/or receive data from a serial port. There should also be sample code on how to read a joystick.

    If you get stuck, let us know, and we'll see what we can do.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.
    Click here to see my Nomad Build Log
Sign In or Register to comment.