from connection import ArduinoSlave import time conn = ArduinoSlave() class AcusticSensor: def __init__(self): pass def start(self): if not conn.isConnected(): conn.open() conn.addRecvCallback(self._readCb) def _readCb(self, raw): print("acc: ", conn.getAcusticRTTs()) def calibrate(self, x, y): pass def read(self): return (0, 0) class MagneticSensor: def __init__(self): pass def start(self): if not conn.isConnected(): conn.open() conn.addRecvCallback(self._readCb) def _readCb(self, raw): print("mag: ", conn.getMagneticField()) def calibrate(self, x, y): pass def read(self): return (0, 0) if __name__ == "__main__": acc = AcusticSensor() acc.start() mag = MagneticSensor() mag.start() while True: time.sleep(1)