sample_python_minimalmodbus.py 415 B

1234567891011
  1. import minimalmodbus
  2. from serial.serialutil import SerialException
  3. # We can't test proper behaviour in emulation, because there is
  4. # actually no emulated modbus hardware, so we rely on the module
  5. # to fail in an expected way to consider it is working correctly.
  6. # Failure (of the script) is success (of the test)!
  7. try:
  8. instrument = minimalmodbus.Instrument('/dev/ttyUSB99', 1)
  9. except SerialException:
  10. pass