123456789101112131415161718192021222324 |
- import time
- from sensors.connection import globalArduinoSlave
- conn = globalArduinoSlave()
- 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 conn.getMagneticField()
|