def __init__(self, cls=MAX31850, **kwargs): self.therm = cls(**kwargs) self.running = True from Adafruit_alphanumeric import AlphaScroller self.display = AlphaScroller(interval=.4) self.display.start() self.display.hide()
class Monitor(threading.Thread): def __init__(self, cls=MAX31850, **kwargs): self.therm = cls(**kwargs) self.running = True from Adafruit_alphanumeric import AlphaScroller self.display = AlphaScroller(interval=.4) self.display.start() self.display.hide() def run(self): while self.running: _, temp = self.therm.get() if temp > 50: if not self.display.shown: self.display.show() fahr = temp * 9. / 5. + 32. text = list('%0.0f'%temp) + ['degree'] + list('C %0.0f'%fahr)+['degree'] + list("F") if 600 <= temp: text += [' ', ' ', 'cone']+list(temp_to_cone(temp)) self.display.set_text(text, reset=False) elif self.display.shown: self.display.hide() def stop(self): self.running = False self.display.stop()
class Monitor(threading.Thread): def __init__(self, cls=MAX31850, **kwargs): self.therm = cls(**kwargs) self.running = True from Adafruit_alphanumeric import AlphaScroller self.display = AlphaScroller(interval=.4) self.display.start() self.display.hide() def run(self): while self.running: _, temp = self.therm.get() if temp > 50: if not self.display.shown: self.display.show() fahr = temp * 9. / 5. + 32. text = list('%0.0f' % temp) + ['degree'] + list( 'C %0.0f' % fahr) + ['degree'] + list("F") if 600 <= temp: text += [' ', ' ', 'cone'] + list(temp_to_cone(temp)) self.display.set_text(text, reset=False) elif self.display.shown: self.display.hide() def stop(self): self.running = False self.display.stop()