' This is a sample showing how to read from and write to a serial port
' using ScriptBasic
'

print "\nStarted\n"

on error goto ErrorLabel

open "asy0" for input as 1
open "asy0" for output as 2

on error goto OtherError

for i = 1 to 5
  print #2, "Please enter line ", i, ":\r\n"
  line input #1,a
  a = chomp(a)
  print #2, "Line ", i, " is ", a, "\r\n"
'  if a = "." then
'	print #2, "that was a dot!\r\n"
'  endif
next i

close 1
close 2

print "No error\n"
goto FinishLabel

ErrorLabel:
print "An error occured opening the serial port\n"
goto FinishLabel

OtherError:
print "An error occurred\n"

FinishLabel:
print "Finished\n"
