You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
845 B
37 lines
845 B
2 years ago
|
import socket
|
||
|
import subprocess
|
||
|
#from picamera2 import Picamera2
|
||
|
import numpy
|
||
|
import time
|
||
|
|
||
|
TCP_IP = '192.168.1.2'
|
||
|
TCP_PORT = 5001
|
||
|
|
||
|
sock = socket.socket()
|
||
|
sock.connect((TCP_IP, TCP_PORT))
|
||
|
|
||
|
#picam2 = PiCamera()
|
||
|
|
||
|
#config = picam2.create_preview_configuration({"size": (640, 480)})
|
||
|
#picam2.configure(config)
|
||
|
#picam2.start()
|
||
|
#array = picam2.capture_array("main")
|
||
|
while(True):
|
||
|
#array = picam2.capture_array("main")
|
||
|
|
||
|
#ock.send( str(len(array)).ljust(16))
|
||
|
#sock.send( array )
|
||
|
#time.sleep(0.070)
|
||
|
command = sock.recv(1)
|
||
|
command = command.decode()
|
||
|
if command == "n":
|
||
|
p = subprocess.Popen("./sensors/sensors", stdout=subprocess.PIPE, shell=True)
|
||
|
(output, err) = p.communicate()
|
||
|
print(output)
|
||
|
print(len(output))
|
||
|
sock.send(str(len(output)).encode())
|
||
|
sock.send(output)
|
||
|
|
||
|
|
||
|
sock.close()
|