KlassischeKeplerKriege/test/shoot_n_times.py
2016-10-04 16:09:15 +02:00

27 lines
514 B
Python
Executable file

#!/usr/bin/env python3
import os
import random
import time
import socket
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])
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ip = "10.172.35.191"
#ip "192.168.0.191"
s.connect((ip, 3490))
for i in range(int(sys.argv[1])):
a = random.randint(0, 360)
msg = str(a) + " \r\n"
s.send(msg.encode())
time.sleep(delay)