Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "windows.bi"
  2.  
  3. dim as handle MYPORT
  4. dim as integer BytesWrite
  5.  
  6. MYPORT = CreateFile("COM11:19200",GENERIC_WRITE or GENERIC_READ,0,null,OPEN_EXISTING,null,null)
  7.  
  8. if MYPORT = 0 or MYPORT = INVALID_HANDLE_VALUE then
  9.   print "Failed to open port..."
  10. else  
  11.   print "port Opened!!!"
  12.   dim as string Text = "Hello World"
  13.   if WriteFile(MYPORT,strptr(Text),len(Text),@BytesWrite,null) then
  14.     print "Writed " & BytesWrite & " Byte to COM11 port"
  15.   else
  16.     print "Failed to write to the port..."
  17.   end if
  18.   CloseHandle(MYPORT)
  19. end if
  20. sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement