This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Serial Library query
#1
Hi All,

I was reviewing the openrb serial library documentation over the last few days.
I have often used the .flush() command as i see is commonly used with the examples on here for rs-485 scripting.
I note the .drain() command in the documentation. I have never used this function and the documentation is a little vague.

Could anyone elaborate on how the .drain() call is best used?

regards,
Brent
Reply
#2
drain() waits until the data has been sent to the port. Usually you don't need to call it all. On some really old versions drain() call was needed before close() otherwise some data could be lost. Now close() will call drain() before closing the port.
Reply


Forum Jump: