Skip to content

Instantly share code, notes, and snippets.

@takashiski
Last active August 29, 2015 14:22
Show Gist options
  • Save takashiski/b4ad31745365a8096241 to your computer and use it in GitHub Desktop.
Save takashiski/b4ad31745365a8096241 to your computer and use it in GitHub Desktop.
自動消灯用スクリプト
import socket
import time
import sys
host = '192.168.1.10'
port = 8899
sleeptime = 10
serversock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
argv = sys.argv
argc = len(argv)
if(argc>=2):
sleeptime = float(argv[1])
serversock.sendto(('450055').decode('hex'),(host,port))
serversock.sendto(('c51b55').decode('hex'),(host,port))
serversock.sendto(('460055').decode('hex'),(host,port))
time.sleep(1)
serversock.sendto(('450055').decode('hex'),(host,port))
for i in range(2,27):
time.sleep(sleeptime)
serversock.sendto(('4e%02x55' % (29-i)).decode('hex'),(host,port))
time.sleep(sleeptime)
serversock.sendto(('460255').decode('hex'), (host,port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment