pythonuwpraspberry-piwindowsiot

Windows IOT Python/UWP interaction on Raspberry pi


I am setting up a Raspberry PI 3 to work with a distance sensor and display to a UWP app. Specifically this model: https://www.tindie.com/products/upgradeindustries/hc-sr05--hy-srf05-precision-ultrasonic-sensor/.

I am looking for a way to run the distance calculation/GPIO in the background in Python, and then display the distance to a UWP app. Does anyone know if this is possible, or could point me in the right direction? Currently the UWP app I have is working, however it does seem unreliable.

Thanks!


Solution

  • First to write a driver for your ultrasonic in Python, see https://github.com/great-coder/RP_Drivers_Python/blob/master/Ultrasonic.py

    Then read this How do I run a Python script from C#?
    to call the python script periodically from UWP.
    You can write the calculated distance inside of fun1 function in python into a file, then read the file inside the UWP app and update the value.