phyphox Forums

Full Version: PHYPHOX TO
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
You need to fetch “x” (depth in meter) or “xmm” (depth in millimeter). The container “d” is the width of the LOESS fit in the settings tab.

You can find such details in the experiment's source at https://github.com/phyphox/phyphox-exper...th.phyphox