![]() Too bad this is worthless, though, because this event isn't guaranteed to be raised! Whaddaya know, my prayers have been answered, there is a DataReceived event provided! += self.OnDataReceived ![]() Ideally, I would have the OS tell me anytime there's data waiting. But as I mentioned I want to be constantly checking this port for new data as it arrives. Reading = () #grabs all bytes currently sitting in the input buffer This lets me write code like this: self.port = System.IO.Ports.SerialPort('COM1', 9600, System.IO., 8, System.IO.) ![]() Now, I'm using IronPython (.NET 4.0) so I have access to the slick SerialPort class built into. As serial port communication is asynchronous, I figured out early on into my project involving communication with a RS 232 device that I will have to have a background thread constantly reading the port for data received.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |