Shop OBEX P1 Docs P2 Docs Learn Events
Use SERout to send keypress event to computer — Parallax Forums

Use SERout to send keypress event to computer

JeanmichelJeanmichel Posts: 5
edited 2009-08-04 19:56 in BASIC Stamp
Hi, sorry my last question was probably a bit blunt. I'm just wondering if it is possible to use SERout to send a keypress event or hotkey to the computer using the serial port which is used for programming the chip.
Essentially I have a hotkey setup on my computer ( vista pc ) which will launch an application when that key (say 6) is pressed, I would like the chip to send information to the computer so it thinks that key 6 has been pressed and therefore launches the application.

Really appreciate any help.

Comments

  • VaatiVaati Posts: 712
    edited 2009-08-04 15:28
    Ok--I myself have not used the SEROUT command too often...

    Correct me if I am wrong, but are you asking whether you can press a key on the computer keyboard/keypad, and it will retrieve some form of data from the BS2 and display it in the debug terminal? If so, I think that is very plausible, but would require some fiddling with vista hotkeys...

    And finally, your last question didn't seem blunt at all, but I think it may be best to start posting replies to a thread instead of asking it all over again in a separate thread, so as to provide a clear explanation to one who has the same question...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!

    *-NEW-* SD Card Adapter·Now available!· Add extra memory to your next Propeller project with ease!
  • JeanmichelJeanmichel Posts: 5
    edited 2009-08-04 15:44
    Hi Vaati, thanks for replying.
    What I'm looking for is actually the other way round. The BS2 has a button attached that when pressed I would like to launch an application on the computer by sending something like a sendkey event using SEROUT.
  • Johnny5Johnny5 Posts: 10
    edited 2009-08-04 16:15
    What you will need is a program that runs in the background that is looking for Serial Input from the BS2 . If the value that you transmit from the chip is correct, then you want the program to launch the application that you desire. I know how to launch the program and run things in the background, but I don't know how to do read from the bs2 and transmit back to the bs2.
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-08-04 19:33
    · Here is a code snippet for you. Use·debug port 16. You can test it easy during development.
    ·
    ·After you got you Stamp code clean quit the editor and run your Stamp code.
    ·Than start your other application on same COM port.
    ·Make sure you are NOT running the Stamp editor·at the·same time!
    ·The OS will not let you use·the··same·COM port.

    ·SetStr VAR byte(5)
    ·....
    · serStr(0) = "H"
    · serStr(1) = "E"
    · serStr(2) = "L"
    · serStr(3) = "L"
    · serStr(4) = "O"
    · SEROUT 16, 16468, [noparse][[/noparse]STR serStr\5]
    ....

    Cheers Vaclav
  • Johnny5Johnny5 Posts: 10
    edited 2009-08-04 19:39
    That's what I was doing wrong, I think! I had Stamp Editor open.
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-08-04 19:56
    Anytime you use hardware (COM ports included) you need to make sure it is responding as expected.
    For example SEROUT does not do any checking if you are actually communicating.
    Same goes for any other application. Most software people do not think about hardware behavior and that gets them into trouble. Since you have no editor running you are "flying blind".
    I would monitor the port by some external means (LED).
    Good luck

    ·
Sign In or Register to comment.