Last active
August 29, 2015 14:22
-
-
Save takashiski/b4ad31745365a8096241 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
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