Shop OBEX P1 Docs P2 Docs Learn Events
EB500 bluetooth module — Parallax Forums

EB500 bluetooth module

JuliusJulius Posts: 8
edited 2007-05-30 01:05 in Robotics
I'm using BS2sx, with intended baudrate of 9600, 8 data bit, no parity bit and stop bit =1
with the EB500 bluetooth module.

is the following code correct to set it visible?

SEROUT 1,240,[noparse][[/noparse]"set visible",CR]
DEBUG "setting visible...",CR
SERIN 0,240,[noparse][[/noparse]WAIT("ACK",CR)]
SEROUT 1,240,[noparse][[/noparse]"on",CR]
DEBUG "visible set",CR

Comments

  • FurfFurf Posts: 1
    edited 2007-05-30 01:05
    I ran some tests and found that when issuing a command you should wait for the Acknowledgment
    ex:· SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]· before performing any other function.

    The SET VISIBLE requires iether· "ON or OFF" as per the documentation but I could not get the command to work. I obviousley get and acknowledgement from the "SET VISIBLE OFF" command, otherwise it would still be waiting for the ACK and not continue.shakehead.gif

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    'Get Visible status
    answer1 var byte(3)··· ' 3 byte array for "O,F,F"· or· "O,N, "
    answer2· var byte(3)
    PAUSE 1000·· 'Wait for the eb500 radio to be ready

    'Connect to the remote device
    DEBUG "Connecting to 00:03:7A:2C:7C:B1",CR· 'laptop
    SEROUT 1,84,[noparse][[/noparse]"con 00:03:7A:2C:7C:B1",CR]··· 'issue command
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]··· 'wait for acceptance of command
    DEBUG "Connected· to device: 00:03:7A:2C:7C:B1",cr

    'Get Visible status
    SEROUT 1,84,[noparse][[/noparse]"get visible",CR]·· 'issue command
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]·· 'wait for acceptance of command
    SERIN 0,84,[noparse][[/noparse]str answer1\3]······ ' I want a STRing of 3 bytes
    DEBUG "Visibility is: ",STR answer1\3,CR·· 'display a STRing of 3 bytes

    'set invisible
    SEROUT 1,84,[noparse][[/noparse]"set visible off",CR]
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
    debug "Can you see me now?",cr
    pause 2000

    'Get Visible status
    SEROUT 1,84,[noparse][[/noparse]"get visible",CR]·· 'issue command
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]·· 'wait for acceptance of command
    SERIN 0,84,[noparse][[/noparse]str answer2\3]······ ' I want a STRing of 3 bytes
    DEBUG "Visibility is: ",STR answer2\3,CR·· 'display a STRing of 3 bytes

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Furf
Sign In or Register to comment.