MMBasic for Windows - betas

Author Message

Senior Member

Joined: 24/10/2012
Location: Australia
Posts: 152
Posted: 12:04am 18 Jun 2023      

Hi All
   I am trying to get MMB4W to search for a picomite connected to the PC. It opens ports from 1 up and sends 'p' then looks for a response. It works until it tries to open a port assigned to 'standard serial over bluetooth link'. Before the 'p' is sent, MMB4W hangs and must be closed manually. If I disable bluetooth it works, and it works if I scan downwards from 40, but I'm not sure that would always be reliable.

using mmb4w 5.07.03 b18

for j=1 to 40
print j,
on error skip 12
open "com"+str$(j)+":38400" as #1
print ,j;" opened"
print #1,"p"
pause 100
line input #1,a$
if left$(a$,1)="P" then
print "found port ";j
exit for
end if
close #1
print "com";j;" closed"
next j
print "port scanning done"
if com=0 then print "com port not found"