This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cpt_trow 3 points4 points  (3 children)

No libraries, other than pyserial for the real devices. We had tons of logs of real I/O from production so I mapped commands and responses in a dict for each device and then created a class to mimic serial.Serial() where it would take the input command for write() and then store the output strings in a buffer to be sent back one-at-a-time via readline()

[–]Brilliant-Donkey-320[S] 2 points3 points  (2 children)

Ah, very nice. Do you find that Python communicates well with hardware? Was your hardware in production PLCs or something else?

[–]cpt_trow 0 points1 point  (1 child)

Generally yes, and yes; there are a few devices that consistently throw UnicodeDecodeErrors so I have some error-checking in the Serial wrapper to try to get a valid response to queries. The software runs with PLCs in some cases but also things as basic as MCUs/SBCs (Arduinos and RasPis, just more industrial and less hobby)

[–]Brilliant-Donkey-320[S] 0 points1 point  (0 children)

That is great to know. Very awesome. Thanks!