Skip to content

Instantly share code, notes, and snippets.

@paulhayes
Last active April 17, 2019 12:40
Show Gist options
  • Save paulhayes/1b66c0ed8475086c85746e0a12a294a7 to your computer and use it in GitHub Desktop.
Save paulhayes/1b66c0ed8475086c85746e0a12a294a7 to your computer and use it in GitHub Desktop.
HW-677 CH340 USB Relay Module
import sys
import serial
import time
ser = serial.Serial("COM1", 9600)
#Open Relay
ser.write( b'\xA0\x01\x01\xA2' )
time.sleep(1)
#Close Relay
ser.write( b'\xA0\x01\x00\xA1' )
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment