j0h

blink PLC in hex

j0h
May 12th, 2026
166
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. from time import sleep
  2. from MiSmSerial import MiSmSerial
  3. # hex bytes to blink Status LED
  4. ON  = bytes.fromhex("05 46 46 30 57 6D 38 30 31 30 31 33 37 0D")
  5. OFF = bytes.fromhex("05 46 46 30 57 6D 38 30 31 30 30 33 36 0D")
  6. plc = MiSmSerial("COM3", baud=9600, timeout=1.0, bcc_mode="enq")
  7. try:
  8.     while True:
  9.         plc._ser.write(ON)
  10.         sleep(1)
  11.         plc._ser.write(OFF)
  12.         sleep(1)
  13. finally:
  14.     plc._ser.write(OFF)
  15.     plc.close()
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment