CASE $DD
LOW LED
DEBUG CR,"Disconnected"
GOSUB Reply
GOTO Program_Start
CASE $11
DEBUG CR,"Servo"
GOSUB Set_Servo_Speed
GOSUB Reply
CASE ELSE
buffer2 = $EE
GOSUB Reply
ENDSELECT
Resume:
PULSOUT 13, tLeft
PULSOUT 12, tRight
SERIN BT_RX, BT_SPEED, 10, Resume, ' Get next command
[WAITSTR buffer \ 2, buffer2,
buffer3, buffer4]
PULSOUT 13, tLeft
PULSOUT 12, tRight
LOOP
Reply:
msgIndex = msgIndex + 1
buffer1 = msgIndex
SEROUT BT_TX, BT_SPEED, [STR buffer \5]
' -----[ Subroutines ]-----------------------------------------------------
Set_Servo_Speed:
tLeft = buffer3 + 650
tRight = buffer4 + 650
RETURN
' -----[ Data ]------------------------------------------------------------
ResetOnOff
RequestConnect
ConnectionGranted
RequestCommand
ServoSpeeds
Copyright © Parallax Inc.
' Disconnect
' Servo
' Error
' If Message not rcvd, try again
' Servo control pulses
' Servo control pulses again
' Increment message index for reply.
' Next message from PC has to use reply's buf[1].
' Maps to 650 to 850 with 750 stopped.
' Decode servo speed.
DATA 0
' On/off toggle w/ Reset button
DATA $FF, 0, 1, 0, 0
DATA $FF, 0, 2, 0, 0
DATA $FF, 0, 3, 0, 0
DATA $FF, 0, 4, 0, 0
Easy Bluetooth (#30085)
v1.3 4/14/2010 Page 9 of 9
Need help?
Do you have a question about the Easy Bluetooth and is the answer not in the manual?