Easy Bluetooth programming via opcode
EmilyP
Posts: 21
I am interested in learning about how to control the easy bluetooth module via it's opcode. Unfortunately, I am unable to get a response such as testing whether any other bluetooth modules are around.
Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
' quick test to see if bluetooth works
rx PIN 2
tx PIN 0
Baud CON 84
combyte VAR Word
STX CON $02
REQ CON $52
CFM CON $43
GAP_INQUIRY CON $00
ETX CON $03
Status VAR Byte
request:
SEROUT tx, baud, [noparse][[/noparse]STX] 'start delim.
SEROUT tx, baud, [noparse][[/noparse]REQ] 'package type
SEROUT tx, baud, [noparse][[/noparse]GAP_INQUIRY] 'opcode
SEROUT tx, baud, [noparse][[/noparse]$00] 'data length
SEROUT tx, baud, [noparse][[/noparse]$03] 'data length
SEROUT tx, baud, [noparse][[/noparse]$55] 'checksum ($52 + $03)
SEROUT tx, baud, [noparse][[/noparse]$30] 'scan ~10 seconds
SEROUT tx, baud, [noparse][[/noparse]$00]
SEROUT tx, baud, [noparse][[/noparse]$00]
SEROUT tx, baud, [noparse][[/noparse]ETX] 'end delim.
recieve:
SEROUT tx, baud, [noparse][[/noparse]STX] 'start delim.
SEROUT tx, baud, [noparse][[/noparse]CFM]
SEROUT tx, baud, [noparse][[/noparse]GAP_INQUIRY]
SEROUT tx, baud, [noparse][[/noparse]$00] 'data length
SEROUT tx, baud, [noparse][[/noparse]$01] 'data length
SEROUT tx, baud, [noparse][[/noparse]$44] 'checksum ($43 + $01)
DEBUG "waiting...", CR
SERIN tx, baud, [noparse][[/noparse]Status]
DEBUG CLS
SEROUT tx, baud, [noparse][[/noparse]ETX]
DEBUG Status, CR
STOP
What am I doing wrong?
Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
' quick test to see if bluetooth works
rx PIN 2
tx PIN 0
Baud CON 84
combyte VAR Word
STX CON $02
REQ CON $52
CFM CON $43
GAP_INQUIRY CON $00
ETX CON $03
Status VAR Byte
request:
SEROUT tx, baud, [noparse][[/noparse]STX] 'start delim.
SEROUT tx, baud, [noparse][[/noparse]REQ] 'package type
SEROUT tx, baud, [noparse][[/noparse]GAP_INQUIRY] 'opcode
SEROUT tx, baud, [noparse][[/noparse]$00] 'data length
SEROUT tx, baud, [noparse][[/noparse]$03] 'data length
SEROUT tx, baud, [noparse][[/noparse]$55] 'checksum ($52 + $03)
SEROUT tx, baud, [noparse][[/noparse]$30] 'scan ~10 seconds
SEROUT tx, baud, [noparse][[/noparse]$00]
SEROUT tx, baud, [noparse][[/noparse]$00]
SEROUT tx, baud, [noparse][[/noparse]ETX] 'end delim.
recieve:
SEROUT tx, baud, [noparse][[/noparse]STX] 'start delim.
SEROUT tx, baud, [noparse][[/noparse]CFM]
SEROUT tx, baud, [noparse][[/noparse]GAP_INQUIRY]
SEROUT tx, baud, [noparse][[/noparse]$00] 'data length
SEROUT tx, baud, [noparse][[/noparse]$01] 'data length
SEROUT tx, baud, [noparse][[/noparse]$44] 'checksum ($43 + $01)
DEBUG "waiting...", CR
SERIN tx, baud, [noparse][[/noparse]Status]
DEBUG CLS
SEROUT tx, baud, [noparse][[/noparse]ETX]
DEBUG Status, CR
STOP
What am I doing wrong?
Comments