1234567891011121314151617181920212223 |
- import sensors
- import time
- distance = 450 #in mm
- def main():
- ac_sensor = sensors.AcusticSensor()
- ac_sensor.start()
- ac_sensor.calibrate(distance)
- try:
- while True:
- x,y = ac_sensor.calculate_position()
- print(x,y)
- time.sleep(2)
- except KeyboardInterrupt:
- print("exit")
- except Exception as e:
- print("Error: ",e)
- main()
|