def __init__(self, orientation, level): self._log = Logger("matrix", level) if orientation is Orientation.PORT: self._matrix11x7 = Matrix11x7(i2c_address=0x77) elif orientation is Orientation.STBD: self._matrix11x7 = Matrix11x7(i2c_address=0x75) # default else: raise Exception('unexpected value for orientation.') self._matrix11x7.set_brightness(0.4) self._is_enabled = False self._screens = 0 self._thread = None self._log.info('ready.')
def _setup(): global matrix11x7 smbus = mock.Mock() smbus.SMBus = mock.Mock() sys.modules['smbus'] = smbus from matrix11x7 import Matrix11x7 matrix11x7 = Matrix11x7()
def __init__(self, level): self._log = Logger("matrix", level) self._matrix11x7 = Matrix11x7() self._matrix11x7.set_brightness(0.4) self._is_enabled = False self._screens = 0 self._thread = None self._log.info('ready.')
def test_setup(): """Test against fake device information stored in hardware mock.""" smbus = mock.Mock() smbus.SMBus = mock.Mock() sys.modules['smbus'] = smbus from matrix11x7 import Matrix11x7 matrix11x7 = Matrix11x7() del matrix11x7
def initI2C(): global matrixInstance stopCount() stopAnimations() matrixInstance = [] for i in range(0, 4): try: ins = Matrix11x7(i2c_address=i + 0x74) except: print("nothing", i, "at address", hex(i + 0x74)) ins = 0 matrixInstance.append(ins)
#!/usr/bin/env python import time from matrix11x7 import Matrix11x7 matrix11x7 = Matrix11x7() # Avoid retina-searage! matrix11x7.set_brightness(0.5) matrix11x7.set_pixel(0, 0, 1) matrix11x7.set_pixel(1, 1, 1) try: while True: for x in [0, 90, 180, 270]: matrix11x7.rotate(x) matrix11x7.show() time.sleep(0.1) except KeyboardInterrupt: matrix11x7.fill(0) matrix11x7.show()