EasyBT bluetooth connection with bluetooth adapter
erdenerus
Posts: 6
hi.I have a difficulty in making connection between EasyBT and my bluetooth adapter.Athough i indicate my bluetooth's number ,when i try to send a parameter from my java program to microcontroller(indicating proper com portnumber) ,nothing happens on robot side.Meanwhile i was able to do that with cable connection.i prensent the bs code below.
Thanks for help by now
' {$STAMP BS2}
' {$PBASIC 2.5}
i VAR Word
pos VAR Byte
pulse1 VAR Word
pulse2 VAR Word
INPUT 5
PAUSE 1000
SEROUT 1,84,[noparse][[/noparse]"con BB:4A:BB:33:BD:0D",CR] //My bluetooth adapter's connection number
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
WaitForConnection:
IF IN5=0 THEN WaitForConnection
DO
SERIN 0,84,[noparse][[/noparse]WAIT(255),pos]
pulse1=pos+650
pulse2=850-pos
FOR i=0 TO 800
PULSOUT 12,pulse1
PULSOUT 13,pulse2
PAUSE 20
NEXT
LOOP
Thanks for help by now
' {$STAMP BS2}
' {$PBASIC 2.5}
i VAR Word
pos VAR Byte
pulse1 VAR Word
pulse2 VAR Word
INPUT 5
PAUSE 1000
SEROUT 1,84,[noparse][[/noparse]"con BB:4A:BB:33:BD:0D",CR] //My bluetooth adapter's connection number
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
WaitForConnection:
IF IN5=0 THEN WaitForConnection
DO
SERIN 0,84,[noparse][[/noparse]WAIT(255),pos]
pulse1=pos+650
pulse2=850-pos
FOR i=0 TO 800
PULSOUT 12,pulse1
PULSOUT 13,pulse2
PAUSE 20
NEXT
LOOP
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
A good program to use to confirm that you have proper Bluetooth connection is the code attached; the BASIC Stamp 2 module listens via the Bluetooth and DEBUGs the value it recieves.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com