ONCOMERROR
Jump to navigation
Jump to search
Description
- This sets or clears a branch label for handling errors when doing serial communications.
Syntax
- ONCOMERROR [branchLabel]
- ONCOMERROR
Hints
- Additional variables set by the command
Example
'open com2
open "COM2:9600,n,8,1" for random as #1
'enable the com error handler
oncomerror [handleIt]
'try to open com2 again, triggering handler
open "COM2:9600,n,8,1" for random as #2
'we never get this far because of the error
print "we never get this far because of the error"
input r$
[handleIt]
'disable the com error handler
oncomerror
'print out the error and port
print "Error: "; ComError$
print "Port number: "; ComPortNumber
print "Error code: "; ComErrorNumber
'close com2
close #1
end
Useful Procedures
' Place a useful function or sub using this keyword here