my idea is that i want to make car with sensors for obstacle avoidance using raspberry pi and Python as programming language.
Thus i want to make a separate thread for sensor in way to keep monitoring the sensor and when it detect obstacle it should directly interrupt the main program( which give the movement command to the motor), and let the car stop
İf you can give me code example or just simulation with virtual sensor.
Or if there is a better practice please advice.
since no one was able to help me, and I could not find tutorials that explain this concept. finally I figured a way to do that and I will share it so that others can make use of it hopefully, or suggest me a better practice if there is a one.