def write(self, bits): if len(bits) != self.outputs: raise OutputDeviceError( "Device initialized with {} outputs, but {} passed in.".format( self.outputs, len(bits))) self.shiftin(list(reversed(bits)))
def decimal_point(self, value): """ Sets the status of the decimal point led """ if len(self) > 7: self[7].value = value else: raise OutputDeviceError( 'there is no 8th pin for the decimal point')
def decimal_point(self): """ Represents the status of the decimal point led """ # does the 7seg display have a decimal point (i.e pin 8) if len(self) > 7: return self[7].value else: raise OutputDeviceError( 'there is no 8th pin for the decimal point')
def write(self, values): # Make sure values are numbers in [0, 1]. values = [float(v) for v in values] if not all(0.0 <= v <= 1.0 for v in values): raise ValueError("Input values must be in the closed interval [0, 1]; outliers found: {}".format(values)) if len(values) != self.outputs: raise OutputDeviceError( "Device initialized with {} outputs, but {} passed in.".format( self.outputs, len(values))) self._state = values