Bluetooth code...
hey everyone,
My next goal is to figure out the bluetooth capbilities in the eb500. MOst of the book and cd is quite difficult to understand, they have get address code,connect code, blah blah blah, Im hoping that someone can help me put together some code that will connect and allow me some co ntrol over the bs2. I have the following code from the manufacturer,
I need to know what this module is capable of and how to use it, I would like to connect my pc, to the bs2 and use the bluetooth to cut on or off ir,thermal,camera and itsself[noparse][[/noparse]bluetooth]
IS thIS possible??
·Description
' ===========
' This program demonstrates switching between command and data mode
' using the mode control I/O line.
'{$STAMP BS2}
szData VAR Byte(20)
'Wait for the eb500 radio to be ready
PAUSE 1000
'Connect to the remote device
SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
'Wait for the connection to be established and switch into data mode.
'When switching into data mode, a 300ms timeout is required to give the
'module enough time to make the change.
WaitForConnection:
· IF IN5 = 0 THEN WaitForConnection
HIGH 6
PAUSE 300
DEBUG "Connection established",CR
SEROUT 1,84,[noparse][[/noparse]"This text is sent in data mode",CR]
'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
DEBUG "In Command Mode",CR
'Get local eb500 Bluetooth Address
SEROUT 1,84,[noparse][[/noparse]"get address",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
'Read the local address from the get command
SERIN 0,84,[noparse][[/noparse]STR szData\17]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
szData(17) = 0
DEBUG "Local eb500 address: ",STR szData\17,CR
'Return to Data Mode
HIGH 6
PAUSE 300
SEROUT 1,84,[noparse][[/noparse]"My eb500 address is ",STR szData,CR]
'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
DEBUG "In Command Mode",CR
'Disconnect from remote device
SEROUT 1,84,[noparse][[/noparse]"dis",CR]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
DEBUG "Disconnected",CR
escription
' ===========
' This program demonstrates how to get the address of the eb500 serial
' Bluetooth module.
''{$STAMP BS2}
'Wait for the eb500 radio to be ready
PAUSE 1000
'Connect to the remote device
SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
'Wait for the connection to be established and switch to data mode
WaitForConnection:
· IF IN5 = 0 THEN WaitForConnection
HIGH 6
PAUSE 300
'Wait for 20 seconds
PAUSE 20000
'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
'Disconnect from the remote device
SEROUT 1,84,[noparse][[/noparse]"dis",CR]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
·
My next goal is to figure out the bluetooth capbilities in the eb500. MOst of the book and cd is quite difficult to understand, they have get address code,connect code, blah blah blah, Im hoping that someone can help me put together some code that will connect and allow me some co ntrol over the bs2. I have the following code from the manufacturer,
I need to know what this module is capable of and how to use it, I would like to connect my pc, to the bs2 and use the bluetooth to cut on or off ir,thermal,camera and itsself[noparse][[/noparse]bluetooth]
IS thIS possible??
·Description
' ===========
' This program demonstrates switching between command and data mode
' using the mode control I/O line.
'{$STAMP BS2}
szData VAR Byte(20)
'Wait for the eb500 radio to be ready
PAUSE 1000
'Connect to the remote device
SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
'Wait for the connection to be established and switch into data mode.
'When switching into data mode, a 300ms timeout is required to give the
'module enough time to make the change.
WaitForConnection:
· IF IN5 = 0 THEN WaitForConnection
HIGH 6
PAUSE 300
DEBUG "Connection established",CR
SEROUT 1,84,[noparse][[/noparse]"This text is sent in data mode",CR]
'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
DEBUG "In Command Mode",CR
'Get local eb500 Bluetooth Address
SEROUT 1,84,[noparse][[/noparse]"get address",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
'Read the local address from the get command
SERIN 0,84,[noparse][[/noparse]STR szData\17]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
szData(17) = 0
DEBUG "Local eb500 address: ",STR szData\17,CR
'Return to Data Mode
HIGH 6
PAUSE 300
SEROUT 1,84,[noparse][[/noparse]"My eb500 address is ",STR szData,CR]
'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
DEBUG "In Command Mode",CR
'Disconnect from remote device
SEROUT 1,84,[noparse][[/noparse]"dis",CR]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
DEBUG "Disconnected",CR
escription
' ===========
' This program demonstrates how to get the address of the eb500 serial
' Bluetooth module.
''{$STAMP BS2}
'Wait for the eb500 radio to be ready
PAUSE 1000
'Connect to the remote device
SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
'Wait for the connection to be established and switch to data mode
WaitForConnection:
· IF IN5 = 0 THEN WaitForConnection
HIGH 6
PAUSE 300
'Wait for 20 seconds
PAUSE 20000
'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
'Disconnect from the remote device
SEROUT 1,84,[noparse][[/noparse]"dis",CR]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
·