01-21-2024, 12:01 PM
Hello, I am currently working on a personal project. However, I need to send the data collected by phyphox to Python. I modeled the following program based on the depth sensor (lidar) category, but in the Python console, it gets stuck at d=0.2m. I want to obtain the real-time distance from my phone to the object in Python. THANK YOU! Here's my code (PS: I'm hiding my IP):
PP_ADDRESS = "XXXXXXX"
PP_CHANNELS = ["d"]
import requests
import time
while True:
try:
url = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS))
data = requests.get(url=url).json()
for i, control in enumerate(PP_CHANNELS):
value = data["buffer"][PP_CHANNELS[i]]["buffer"][0]
print("Channel " + str(control) + " = " + str(value))
except Exception as e:
print("An error occurred:", e)
time.sleep(1)
PP_ADDRESS = "XXXXXXX"
PP_CHANNELS = ["d"]
import requests
import time
while True:
try:
url = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS))
data = requests.get(url=url).json()
for i, control in enumerate(PP_CHANNELS):
value = data["buffer"][PP_CHANNELS[i]]["buffer"][0]
print("Channel " + str(control) + " = " + str(value))
except Exception as e:
print("An error occurred:", e)
time.sleep(1)