Esempio n. 1
0
class Display:

#active_cols = []

    def __init__(self,rowgpios,colgpios):
        self.numrows = len(rowgpios)
        self.numcols = len(colgpios)
        self.led_array = LEDArray(self.numrows, self.numcols)
        self.gpio_module = GPIOModule(rowgpios,colgpios)

    def outputPattern(self):
        # turn off current row
        self.gpio_module.deactivateRow()
        # shifting the circular queues
        self.gpio_module.rowgpios.shift()
        self.led_array.rowindices.shift()
        # getting the new set of active columns
        active_cols = self.led_array.getActiveColumns(self.led_array.getRowIndex())
        # Outputting Values to the LED Grid Hardware
        self.gpio_module.outputColumns(active_cols)
        # Activate the new row
        self.gpio_module.activateRow()

    '''
    run time - time displays
    update time - flickering time
    '''
    def run(self, array, run_time, update_time):
        dt = 0

        self.led_array.updateArray(array)

        timestart = time.time()
        while dt < run_time:

            self.outputPattern()
            time.sleep(update_time)
            dt = time.time()-timestart
Esempio n. 2
0
 def __init__(self,rowgpios,colgpios):
     self.numrows = len(rowgpios)
     self.numcols = len(colgpios)
     self.led_array = LEDArray(self.numrows, self.numcols)
     self.gpio_module = GPIOModule(rowgpios,colgpios)