Created
August 19, 2020 04:42
-
-
Save command-tab/8551bbe7033d6c7d4b2fa3ffa4b8067b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
# "SMAKN LCUS-1 type USB relay module USB intelligent control switch USB switch" | |
# https://www.amazon.com/gp/product/B01CN7E0RQ/ | |
# pipenv install pyserial | |
import serial | |
import time | |
# https://pyserial.readthedocs.io/en/latest/tools.html#serial.tools.list_ports.grep | |
with serial.Serial('/dev/tty.usbserial-1430', 9600, timeout=1) as ser: | |
ser.write(serial.to_bytes([0xA0, 0x01, 0x01, 0xA2])) # ON | |
time.sleep(3) | |
ser.write(serial.to_bytes([0xA0, 0x01, 0x00, 0xA1])) # OFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment