main.py 403 B

1234567891011121314151617181920212223
  1. import sensors
  2. import time
  3. distance = 450 #in mm
  4. def main():
  5. ac_sensor = sensors.AcusticSensor()
  6. ac_sensor.start()
  7. ac_sensor.calibrate(distance)
  8. try:
  9. while True:
  10. x,y = ac_sensor.calculate_position()
  11. print(x,y)
  12. time.sleep(2)
  13. except KeyboardInterrupt:
  14. print("exit")
  15. except Exception as e:
  16. print("Error: ",e)
  17. main()