def __init__(self): print("SPI Source") Source.__init__(self) self._pidaq = PiDAQ(0, 0) #self._timer = LoopingCall(self.sample) #print("Starting Sample Timer") #self._timer.start(1) self.stopping = False reactor.callInThread(self.sample)
def __init__(self): Source.__init__(self) try: self._device = InterfaceKit() except RuntimeError as e: print("Runtime Error: %s" % e.message) try: self._device.openPhidget() except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.detail)) self._device.setOnSensorChangeHandler(self.sensor_changed) print("Phidget: Waiting for Connection") self._device.waitForAttach(10000) self._device.setSensorChangeTrigger(0, 0) self._device.setDataRate(0, 1) print("Phidget: Connected")
def __init__(self): Source.__init__(self) self._sample_number = 0 self._timer = LoopingCall(self.sample) self._timer.start(0.01)