import time from config import * from sensor import SensorService from mqtt_client import mqtt_client def main(): sensor_service = SensorService() sensor_service.start() while True: try: time.sleep(0.1) except KeyboardInterrupt: print("程序收到中断信号,正在退出...") sensor_service.stop() mqtt_client.stop() break if __name__ == "__main__": main()