Advertisement
iderrington

BT Config Script

May 13th, 2013
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  'CoreBASIC script to confirm and configure external BT
  2.  'module
  3.  '
  4.  INSTALL "UART" AS UART
  5.  '
  6.  UART.SPEED = 9600
  7.  UART.DATA = 8 ' 8 data bits
  8.  UART.PARITY = 0 ' no parity
  9.  UART.STOP = 1 ' 1 stop bit
  10.  '
  11.  CLS
  12.  CALL CHECK_BT_MODULE
  13.  '
  14.  END
  15.  '
  16.  DEFPROC CHECK_BT_MODULE()
  17.     UART.PRINT = "AT"
  18.     WAIT UART.LEFT = 0
  19.     TIMER = 0
  20.     REPEAT
  21.     UNTIL(TIMER > 4000) OR (UART.READY >= 2)
  22.      '
  23.     IF TIMER > 4000 THEN
  24.        PRINT "No BT module found!"
  25.     ELSE
  26.        PRINT "BT module found!"
  27.        S = UART.RX(2)
  28.       UART.PRINT = "AT+NAMESOLDERCORE"
  29.       WAIT UART.LEFT = 0
  30.       '
  31.      TIMER = 0
  32.      REPEAT
  33.      UNTIL(TIMER > 4000) OR (UART.READY >= 9)
  34.      '
  35.      IF TIMER > 4000 THEN
  36.        PRINT "No Response...Weird"
  37.     ELSE
  38.        PRINT UART.RX(20)
  39.     ENDIF
  40.  ENDIF ENDPROC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement