'-----------------------------------------------
' (c) 2006 AVR projects
'--------------------------------------------------------------
' file: Bluetooth.bas
' comport settings: COM1,9600,N,8,1
' device AT M8
' Xtal freq: 4096000 Hz
' Hardware req.: ATmega8 board, RS232 connection with AUBTM-20
' Software: Hyperterminal
'--------------------------------------------------------------
$regfile = "m8def.dat"
$sim
Config Lcd = 16 * 2
Cls
Cursor Off
Dim Name_s As String * 60
Dim X As Integer
Dim Store As String * 60
Dim Name1 As String * 60
Dim Addr1 As String * 60
Dim Name2 As String * 60
Dim Addr2 As String * 60
Dim K As Byte
Dim L As Byte
K = 13
L = 10
Dim S As String * 80
Dim Ar(5) As String * 30
Dim Bcount As Byte
Dim J As Byte
$crystal = 11059200 'change this value into the value of the Xtal you use.
$baud = 19200
Print Chr(k)
Print Chr(l)
Print "LLL"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "AT+NAME=?"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "<cr><lf>AT+F<cr><lf>"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "<cr><lf>AT+MODE=2<cr><lf>"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "AT+BAUD="9600 ","0 ","0 ""
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "AT+BPROFILE=1"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "AT+BSERVICEATTR=1,0,1"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Cls
Print Chr(k)
Print Chr(l)
Print "<cr><lf>AT+INQ<cr><lf>"
Print Chr(k)
Print Chr(l)
Input Name_s
Store = Name_s
Bcount = Split(store , Ar(1) , ",")
For J = 1 To Bcount
Addr1 = Ar(1)
Name1 = Ar(2)
Print Ar(j)
Lcd Addr1
Wait 5
Next
Bcount = Split(addr1 , Ar(1) , "+INQ")
For J = 1 To Bcount
Addr2 = Ar(1)
Print Addr2
Next
Print Chr(k)
Print Chr(l)
Print "AT+BDISCMODE=1,180"
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
Print Chr(k)
Print Chr(l)
Print "AT+OPPCON=" ; Addr1 ; ","8 ""
Print Chr(k)
Print Chr(l)
Input Name_s
Print Name_s
Lcd Name_s
End
sir i have prepared this code.
is it the way to write a code using at commands???