2016-10-02 19:06:02 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import random
|
|
|
|
import time
|
|
|
|
import socket
|
2016-10-03 16:56:49 +00:00
|
|
|
import sys
|
|
|
|
|
|
|
|
delay = 0.1
|
|
|
|
|
|
|
|
if len(sys.argv) <= 1:
|
|
|
|
print("usage: ./prog $NUM_SHOOTS [$FLOAT_DELAY_BETWEEN_SHOTS]")
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
if len(sys.argv) > 2:
|
|
|
|
delay = float(sys.argv[2])
|
2016-10-02 19:06:02 +00:00
|
|
|
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
2016-10-04 17:12:04 +00:00
|
|
|
s.connect(("192.168.0.191", 3490))
|
2016-10-02 19:06:02 +00:00
|
|
|
|
2016-10-03 16:56:49 +00:00
|
|
|
for i in range(int(sys.argv[1])):
|
2016-10-02 19:06:02 +00:00
|
|
|
a = random.randint(0, 360)
|
|
|
|
msg = str(a) + " \r\n"
|
|
|
|
s.send(msg.encode())
|
2016-10-03 16:56:49 +00:00
|
|
|
time.sleep(delay)
|
2016-10-02 19:06:02 +00:00
|
|
|
|