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.