-
Notifications
You must be signed in to change notification settings - Fork 6
Sync_hardware_software
ChenXF edited this page Feb 8, 2023
·
2 revisions

A task is commonly triggered by ArControl Recorder > START button. However, the task can triggered from other style. Open ArControl Designer > File > Profile > "Start" Model. There are immediately, Trigger by Hardware (pin_11_HIGH), Trigger by: Software (serial communicate), Trigger by: Software or Hardware.

Use python socket to start/stop ArControl Recorder as like click the "START" button.
- Open the
ArControl Recorder > Menu > Tool > Socket. - Record the
ArControl RecorderMenu > Tool > Socket > PORT, etc 20171. - Run the code
python ARCONTROL_DIR/pytools/testsocket.py.
# testsocket.py
import socket
import time
# %% create connection
tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serve_ip = 'localhost'
serve_port = 20171 #default ArControl Recorder Socket PORT
tcp_socket.connect((serve_ip, serve_port))
def send_read(send_data):
send_data_byte = send_data.encode("utf-8")
tcp_socket.send(send_data_byte)
from_server_msg = tcp_socket.recv(1024)
print(from_server_msg.decode("utf-8"))
# %% Supported commands
cmds = ['query_record', 'start_record', 'stop_record']
for send_data in cmds:
send_read(send_data)
time.sleep(5)- Or you can run the code in
linux->bashorwindows->wsl
$nc -q 1 localhost 20171 < <(echo "query_record")
$nc -q 1 localhost 20171 < <(echo "start_record")
$nc -q 1 localhost 20171 < <(echo "stop_record")Or you can run the code in windows->cmd
C:\>telnet localhost 20171
Microsoft Telnet> sen query_record
Microsoft Telnet> sen start_record
Microsoft Telnet> sen stop_record