123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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)
|