Shop OBEX P1 Docs P2 Docs Learn Events
Visual Basic & bluetooth & BasicStamp — Parallax Forums

Visual Basic & bluetooth & BasicStamp

thelaythelay Posts: 1
edited 2006-06-23 23:58 in BASIC Stamp
Hi,

I would llike to get help.
My project scenrio is as follows.
My CMUcam is connected to basicstamp and eb500. My PC is connected to bluetooth adaptor.
I would like to write a GUI from that i can send the data to CMU via bluetooth adaptor. From that bluetooth adaptor to eb500 and eb500 to basicstamp and basicstamp to CMU cam.
Can you suggest me what language should i use and some examples for that.
If i want to use visual basic .net. how can i find the examples?
I need urgent.
thanks.
with regards,·

Comments

  • shortcircuitshortcircuit Posts: 11
    edited 2006-06-23 23:58
    wrote a nice gui yesterday which controls the servos etc. my new version has alot of functinality you wont need so ive just included the juicy bits here.

    in VB its easiest to add the MSCOMM control (to handle the serial comms) to your form
    then set it up in the code with comething like this
    Private Sub Form_Load()
    ' Fire Rx Event Every Two Bytes
    MSComm1.RThreshold = 20 'number of characters to accept from incoming
    ' 115200 Baud, No Parity, 8 Data Bits, 1 Stop Bit
    MSComm1.Settings = "115200,N,8,1"
    ' Disable DTR
    MSComm1.DTREnable = False
    ' Open COM1
    MSComm1.CommPort = 1
    If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
    End Sub
    
    



    you should always terminate the com when unloadiung the form (below)

    Private Sub Form_Unload(Cancel As Integer)' should include this so the port dosent stay open after you close thr app.
    MSComm1.PortOpen = False
    End Sub
    
    



    when the CMU sends data to you is is received by the oncomm event and dumped into a var ive called sdata

    Private Sub MSComm1_OnComm()            ' handles incoming data from CMU CAM and puts it into sdata
    Dim sData As String     ' Holds our incoming data
    Dim lHighByte As Long   ' Holds HighByte value
    Dim lLowByte As Long    ' Holds LowByte value
    Dim lWord As Long       ' Holds the Word result
    If MSComm1.CommEvent = comEvReceive Then ' If comEvReceive Event then get data and display
    sData = MSComm1.Input     
    print cstr(sdata)                      ' makes sure you can read it. couled also say text1.text=cstr(sdata) or something if you have a textbox
    End sub
    




    this will send the contents of a variable (perhaps from a textbox) called 'cache' out to the CMU
    MSComm1.Output = cache              'gets var you want to send and sends it
    





    the syntax of commands to address the CMU via serial are located in the manual at www.cs.cmu.edu/~cmucam2/CMUcam2_manual.pdf
    but to begin with try sending the command GV short for get version. the CMU should reply with something like CMU CAM v1.....
Sign In or Register to comment.