def heartbeat(self, activeSensors):
        if self.output:
            return
        if self.locks[0] and self.locks[1] and self.locks[2]:
            self.output = self.initials[0] + self.initials[1] + self.initials[2]

        r = self.offset[0]
        c = self.offset[1]

        self.display.set(r, c-1, Shapes.charToShape(self.initials[0]), Colors.YELLOW if self.locks[0] else Colors.CYAN)
        self.display.set(r, c, Shapes.charToShape(self.initials[1]), Colors.YELLOW if self.locks[1] else Colors.CYAN)
        self.display.set(r, c+1, Shapes.charToShape(self.initials[2]), Colors.YELLOW if self.locks[2] else Colors.CYAN)
 def setMessage(self, row, message, color = Colors.WHITE, start = 0, cutoff = -1):
     #TODO: ability to right-justify
     if cutoff is -1:
         cutoff = self.cols
     shapes = Shapes.stringToShapes(message)
     col = start
     while col < cutoff and len(shapes) > 0:
         self.set(row, col, shapes.pop(0), color)
         col += 1
 def __init__(self, text, color=Colors.WHITE, height=1, width=None):
     super().__init__()
     self.charString = Shapes.stringToShapes(text)
     self.direction="left"
     self.height = height
     self.color = color
     if width is None:
         self.width = len(self.charString)
     else:
         self.width = width
 def setDigit(self, row, column, digit, color=None):
     """
         Sets the tile at row, column to the provided digit.
     """
     tile = self.tiles[row][column]
     try:
         tile.setShape(Shapes.digitToHex(int(digit)))
         if color is not None:
             tile.setColor(color)
     except AttributeError:
         print("SetDigit failed: No tile exists at ({:d},{:d}).".format(row, column))
def main():
    print("Testing LSDisplay with virtual floor")
    display = LSDisplay(3,8)

    for j in range(8):
        display.setColor(0, j, Colors.RED)
        display.setShape(0, j, Shapes.ZERO)
    wait(0.2)
    for j in range(8):
        display.setColor(1, j, Colors.YELLOW)
        display.setShape(1, j, Shapes.ZERO)
    wait(0.2)
    for j in range(8):
        display.setColor(2, j, Colors.GREEN)
        display.setShape(2, j, Shapes.ZERO)
    wait(0.2)
    for i in range(3):
        for j in range(8):
            display.setShape(i, j, Shapes.digitToHex(i))
            wait(0.01)
    wait(0.2)
    for i in range(0, 100):
        display.heartbeat()