|
|
|
class Sensor(object):
|
|
""" Container abstraction for a 'sensor' """
|
|
|
|
def __init__(self, led, temp_sensor_function):
|
|
self.led = led
|
|
self.temp_sensor_function = temp_sensor_function
|
|
|
|
def get_temp(self):
|
|
return round(self.temp_sensor_function())
|
|
|
|
# When the "temp" attribute is accessed call the temp sensor function
|
|
# which will return the desired temperature reading
|
|
temp = property(get_temp)
|