Skip to content

Instantly share code, notes, and snippets.

View danboid's full-sized avatar

Dan MacDonald danboid

  • The Unicorn Foundation
  • England
View GitHub Profile
@RJ
RJ / HALJIA USB Relay Module.py
Created May 11, 2018 15:29
Python to control cheap USB relay from amazon: QinHeng Electronics HL-340 USB-Serial adapter
# To run with pyusb debugging:
#
# PYUSB_DEBUG=debug python relay.py
#
# Grab the vendor and product codes from syslog when plugging in the relay:
#
# usb 3-1: New USB device found, idVendor=1a86, idProduct=7523
#
import time
import usb.core