I’m still looking for a solution to get all units locations from SPI.
But if you want to use python to access over uart api you can use these codes;
les , lec or lep command is works forever as i want but if you dont want this you can easily change while condition to do that.
import serial
import time
port = '/dev/ttyS0'
baud = 115200
ser = serial.Serial(port, baud, timeout=0)
def read_msg(msg):
response = ""
ser.flushOutput()
msg = msg + "\r"
msg=msg.encode()
ser.write(msg)
time.sleep(0.1)
while response != "".encode():
response = ser.readline()
time.sleep(0.1)
if response != "dwm> ".encode() and response.decode().strip() != msg.decode().strip():
# do whatever you want with this response
print(response.decode().strip())
ser.flushInput()
ser.write(b'\r\r')
time.sleep(0.5)
ser.flushInput()
# read anchors list
read_msg("la")
# read unit modes
read_msg("nmg")
# read accelerometer values
read_msg("av")
example outputs:
read_msg(“av”)
acc: x = 96, y = 816, z = 16208
read_msg(“la”)
[006019.650 INF] AN: cnt=0 seq=xFF
[006019.650 INF]
read_msg(“nmg”)
mode: ani (pasv,-,-)
New forums interface for sharing codes is not shinny. You can find the code that i wrote in