This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

PHYPHOX TO
#1
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)
Reply


Messages In This Thread
PHYPHOX TO - by Hydro1e - 01-21-2024, 12:01 PM
RE: PHYPHOX TO - by Jens Noriʇzsɔɥ - 01-21-2024, 04:20 PM

Forum Jump: