I am working on a project in which I receive a stream of data from a distance-measuring sensor(VL53L0x sensor). This data is populated onto my Serial monitor and I send this info to my python compiler to perform tasks (eg. taking the average of the 5 consecutive distance points etc. ) using the "pyserial" library. However, based on those python tasks, I wanted to send info back to the servo motor connected to my Arduino simultaneously. eg. If the avg. distance is 20mm, servo motor should be angled at 110deg.
I am unable to find a solution on how I could do this. Could you recommend a way I could receive input and also send output to Arduino pins in real-time?
Thanks