Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import sleep
- from MiSmSerial import MiSmSerial
- # hex bytes to blink Status LED
- ON = bytes.fromhex("05 46 46 30 57 6D 38 30 31 30 31 33 37 0D")
- OFF = bytes.fromhex("05 46 46 30 57 6D 38 30 31 30 30 33 36 0D")
- plc = MiSmSerial("COM3", baud=9600, timeout=1.0, bcc_mode="enq")
- try:
- while True:
- plc._ser.write(ON)
- sleep(1)
- plc._ser.write(OFF)
- sleep(1)
- finally:
- plc._ser.write(OFF)
- plc.close()
Advertisement