-
Notifications
You must be signed in to change notification settings - Fork 0
/
wifitest.bsc
51 lines (42 loc) · 945 Bytes
/
wifitest.bsc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
uconfig 115200
buffer=alloc(500) :buflen=0
print "Checking Wifi Module"
call serialsend( "AT" )
call serialread( )
print "Set no echo"
call serialsend( "ATE0" )
call serialread( )
print "Set DNS server to Google"
call serialsend( "AT+CIPDNS_CUR=1,"+chr$(34)+"8.8.8.8"+chr$(34) )
call serialread( )
print "Ping Google"
call serialsend( "AT+PING="+chr$(34)+"www.google.com"+chr$(34) )
call serialread( )
print "Check for Wifi hotspots"
call serialsend( "AT+CWLAP" )
call serialread( )
print "Requesting IP Address"
call serialsend( "AT+CIFSR" )
call serialread( )
print ""
print "Done"
print ""
end
proc serialread( )
while uhasdata( ) =0
wait 1
wend
while uhasdata( ) = -1
ureceive buffer+buflen,1
buflen=buflen+1
wend
for c=0 to buflen
print chr$(peek(buffer+c) ) ;
next
buflen=0
print""
endproc
proc serialsend(st$ )
usend st$ +chr$(13) +chr$(10)
wait 50
endproc