Shop OBEX P1 Docs P2 Docs Learn Events
BS2sx and VB — Parallax Forums

BS2sx and VB

lindblindb Posts: 10
edited 2005-07-01 20:14 in BASIC Stamp
hello,

How can i use my Basic stamp II sx·to communicate with Visual Basic 6?


sweden

Post Edited By Moderator (Jon Williams (Parallax)) : 6/30/2005 1:01:14 PM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-30 13:00
    That depends on what you want to do.· For the most reliable connection I recommend using a "full" connection with flow control, that way your VB program won't attemp to send something when the BASIC Stamp isn't ready for it.· This article will show you how:

    http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf



    Note: Remember to add a subject line to your posts -- you'll get more responses and get them quicker (I fixed this one).



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-06-30 16:20
    A simple example, based on the BS2 and VB, is attached
    (You'll have to change the 'baudmode' parameter for the
    ·faster BS2sx).
  • lindblindb Posts: 10
    edited 2005-07-01 20:02
    Hello again

    What i am trying to do is to use two (or more) ir-detectors sending their signals to Visual basic separatly(did i spell that right[noparse]:)[/noparse]

    For example: when the·first ir-detector generate a·signal it will·appear a red box in VB, when the second·ir-detector generate a signal it will appear a·green box.

    Hello from sweden

    lindbäck
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-07-01 20:14
    What you'll need to do is write a VB program, which will recieve data from the BS2 over a serial port (or a USB to Serial adapter -- they look the same to VB).

    Then write a BS2 program which will 'sample' two (or more) ir-detectors, translate what it sees into some message, and send that message to the VB program using SEROUT over the serial port.

    You'll need to define some kind of protocol so the VB program knows which IR detector is being communicated. Something like:

    "! IR1 ON "
    "! IR2 OFF "

    Meaning IR1 got an ON reading (whatever that means), and IR2 got an 'OFF' reading.

    Then in the VB program you can easily update the background color property of a text-box, for instance, to make it red or green.
Sign In or Register to comment.