1
0
Fork 0
kirdy-firmware/eth_cmd_test.py

25 lines
688 B
Python

# Python Test Scripts for Controlling Kirdy
# Kirdy is written to be controlled via a json object based on miniconf rust crate
# Json Field:
# "rev": hw_rev
# "laser_diode_cmd": Check cmd_handler.rs for the cmd Enum to control the laser diode
# "data_f32": Optional f32 Data field depending on cmd
# "data_f64": Optional f64 Data field depending on cmd
import socket
import json
# Kirdy IP and Port Number
HOST = "192.168.1.132"
PORT = 1337
ld_cmd = {
"rev": 3,
"laser_diode_cmd": "SetI",
"data_f64": 0.0,
}
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
s.send(bytes(json.dumps(ld_cmd), "UTF-8"))