Shop OBEX P1 Docs P2 Docs Learn Events
bluetooth and basic on a pc — Parallax Forums

bluetooth and basic on a pc

StickySticky Posts: 42
edited 2009-05-13 12:21 in BASIC Stamp
Anybody had any experience interfacing an easy bluetooth module with a basic program on a PC and would you like to give some pointers if you have? I'm trying out something called just Basic and I seem to connect to the port for the bluetooth but I can't get data from it yet. Here is the program I'm trying.

Comments

  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-13 03:50
    Yes. I have a post here a few months ago for using the module and vb.net

    Ill give you a generic line of code i use.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    x VAR word
    x=50
    SEROUT 1,84 ,[noparse][[/noparse]"TX", 10, DEC x ,10]
    
    
  • StickySticky Posts: 42
    edited 2009-05-13 03:58
    I forgot to submit the BS2 code, here it is. The Bs2 works well and I get data into another debug window using com3 (bluetooth serial port on my pc.) It's the basic end I need help with. (The upload manager wasn't working for me so :
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    mresult VAR Byte
    BT_RX PIN 2 ' RX of the Easy Bluetooth
    BT_TX PIN 0 ' TX of the Easy Bluetooth
    LED PIN 8 ' Indicator LED for Bluetooth Connection
    j VAR Nib

    DO
    FOR j = 1 TO 3
    HIGH led
    PAUSE 100
    LOW led
    PAUSE 100
    NEXT
    'DEBUG "Waiting for data . . ." , CR
    SERIN BT_RX , 84 , 2000, no_data , [noparse][[/noparse]mresult]


    DEBUG "Bluetooth got data - woo woo ", CR
    SEROUT BT_TX , 84 ,[noparse][[/noparse]"The bluetooth, just got data" , CR]
    PAUSE 250
    LOW led
    PAUSE 250

    _pass:
    PAUSE 2000

    SEROUT BT_TX , 84 ,[noparse][[/noparse]"The bluetooth, just transmitted this" , CR]
    PAUSE 500


    LOOP

    no_data:
    DEBUG "No data ", CR
    PAUSE 1000
    GOTO _pass
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-13 04:44
    What do you mean basic end?
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-13 04:54
    Heres the example I was talking about:
    In the BASIC stamp editor enter this:
    ' {$STAMP BS2}
    ' {$PBAsic 2.5}
    x VAR Word
    x=50
    Do
    SEROUT 1,84 ,[noparse][[/noparse]"TX", 10, DEC x ,10]
    PAUSE 100 'Pause for 1 sec
    Loop
    

    If you dont have Visual Studio 2008 you can download it from Microsoft. Get Visual Basic Express.
    Open the attached zip and open the .sln (solution) file.

    It will show you the Form window. Click on the SerialPort1 on the bottom of the screen, and it will show properties window on the right for it.

    Scroll down and find COM3, change this to yours (unless thats what you have.)
    Now press F5 or click run on the menu bar. Click connect, if it gives you error, then you have the wrong COM port selected. Otherwise it should display 50 in the form.
    Hope this helps.
  • StickySticky Posts: 42
    edited 2009-05-13 12:21
    Ok thanks for the help, I'll give it a try.
Sign In or Register to comment.