12345678910111213141516171819202122 |
- from sensors.connection import globalArduinoSlave
- import time
- 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()
|