Example #1
0
def tick():
    while True:
        date = strftime('%a') + " " + strftime('%x')
        LEDMatrix.scroll_message_horiz([date], 1, 5, DIR_L, TINY_FONT)
        sleep(1)
        cycle = 1
        while cycle < 80:
            H = strftime('%H')
            M = strftime('%M')
            S = strftime('%S')
            LEDMatrix.static_message(H + M + S, DIR_RD, 0, TINY_FONT)
            cycle += 1
            sleep(0.5)
Example #2
0
def tick():
    while True:
        date = strftime('%a') + " " + strftime('%x')
        LEDMatrix.scroll_message_horiz([date], 1, 5, DIR_L, TINY_FONT)
        sleep(1)
        cycle = 1
        while cycle < 80:
            H = strftime('%H')
            M = strftime('%M')
            S = strftime('%S')
            LEDMatrix.static_message(H+M+S, DIR_RD, 0, TINY_FONT)
            cycle += 1
            sleep(0.5)
Example #3
0
def matrix():
    for c in range(0, 8):
        r = random.randint(0, 1)
        for k in range(0, len(data[r]) - 8):
            for j in range(
                    0, 5
            ):  # Repeat enough times to display the smiling face a period of time
                x = 0x80
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, data[r][i]
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x >>= 1
Example #4
0
def Dot():
    for c in range(0, 100):
        z = random.randint(0, 7)
        s = random.randint(0, 7)
        if z == 0:
            pos = 128
        elif z == 1:
            pos = 64
        elif z == 2:
            pos = 32
        elif z == 3:
            pos = 16
        elif z == 4:
            pos = 8
        elif z == 5:
            pos = 4
        elif z == 6:
            pos = 2
        elif z == 7:
            pos = 1
        data = [0, 0, 0, 0, 0, 0, 0, 0]
        data[s] = pos
        data[not s] = 0
        for j in range(0, 15):
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
Example #5
0
def matrixx():
    global pos1, pos2, pos3, pos4, l1, l2, l3, l4, data
    data = [0, 0, 0, 0, 0, 0, 0, 0]
    data.clear()
    for z in range(0,100):
        data = [0, 0, 0, 0, 0, 0, 0, 0]
        randomize()
        for l in range(0,15):
            data[pos1] = l1
            data[pos2] = l2
            data[pos3] = l3
            data[pos4] = l4
            #data[not pos] = 0
            for j in range(0,2):
                x = 0x01
                for i in range(0,8):
                    GPIO.output(latchPin,GPIO.LOW)
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,int(data[i])) #first shift data of line information to first stage 74HC959   
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column information to second stage 74HC959
                    GPIO.output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)# display the next column
                    x<<=1
            posi()
Example #6
0
def snakeL():
    for c in range (0,5):
        print(5-c)
        for h in range(0,7,2):
            for k in range(0,len(snake[h])-8):
                for j in range(0,5):# Repeat enough times to display the smiling face a period of time
                    x=0x01
                    for i in range(k,k+8):
                        GPIO.output(latchPin,GPIO.LOW)
                        LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,snake[h][i]) #first shift data of line information to first stage 74HC959
                    
                        LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column information to second stage 74HC959
                        GPIO.output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the same time
                        time.sleep(0.001)# display the next column
                        x<<=1
            for k in range(0,len(snake[h+1])-8):
                for j in range(0,5):# Repeat enough times to display the smiling face a period of time
                    x=0x80 #x=0x80
                    for i in range(k,k+8):
                            GPIO.output(latchPin,GPIO.LOW)
                            LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,snake[h+1][i]) #first shift data of line information to first stage 74HC959
                   
                            LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column information to second stage 74HC959
                            GPIO.output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the same time
                            time.sleep(0.001)# display the next column
                            x>>=1
    print(0)
    print()
    print()
    if LEDMatrix.Num:
        print("# = Diese Liste")
        print("* = beenden")
        print("A = Taschenrechner")
        print("B = Dez-Bin-Hex-Rechner")
        print("C = GUI")
        print("1 = wuerfeln (16-seitig)")
        print("2 = Zeit anzeigen")
        print("3 = Display CPU-Temp")
        print("4 = 'snake'")
        print("5 = 'snake-game'")
        print("6 = 'matrix'")
        print("7 = matrix2'")
        print("8 = random Punkt")
        print("9 = 'Bislschirmschoner'")
        print("0 = Karte ziehen")
Example #7
0
def show():
    global d_ver, d_hor, ver, hor, data
    d_ver = ver.get()
    d_hor = hor.get()

    if d_hor == 1 and d_ver == 1:

        getstates()
        for l in range(0, 8):
            data[l] = data[l] / 128
        for i in range(0, 8):
            data.insert(0, 0)
            data.append(0)
        for k in range(0, len(data) - 8):
            for j in range(0, 20):
                x = 0x01
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, int(data[i])
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x <<= 1
            up()

    elif d_hor == 1 and d_ver == -1:

        getstates()
        for l in range(0, 8):
            data[l] = data[l] * 128
        for i in range(0, 8):
            data.insert(0, 0)
            data.append(0)
        for k in range(0, len(data) - 8):
            for j in range(0, 10):
                x = 0x01
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, int(data[i])
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x <<= 1
            down()

    elif d_hor == -1 and d_ver == 1:

        getstates()
        for l in range(0, 8):
            data[l] = data[l] / 128
        for i in range(0, 8):
            data.insert(0, 0)
            data.append(0)
        for k in range(0, len(data) - 8):
            for j in range(0, 10):
                x = 0x80
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, int(data[i])
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x >>= 1
            up()

    elif d_hor == -1 and d_ver == -1:

        getstates()
        for l in range(0, 8):
            data[l] = data[l] * 128
        for i in range(0, 8):
            data.insert(0, 0)
            data.append(0)
        for k in range(0, len(data) - 8):
            for j in range(0, 10):
                x = 0x80
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, int(data[i])
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x >>= 1
            down()

    elif d_hor == 1 and d_ver == 0:

        getstates()
        for i in range(0, 8):
            data.insert(0, 0)
            data.append(0)
        for k in range(0, len(data) - 8):
            for j in range(0, 10):
                x = 0x01
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, data[i]
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x <<= 1

    elif d_hor == -1 and d_ver == 0:

        getstates()
        for i in range(0, 8):
            data.insert(0, 0)
            data.append(0)
        for k in range(0, len(data) - 8):
            for j in range(0, 10):
                x = 0x80
                for i in range(k, k + 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, data[i]
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x >>= 1

    elif d_hor == 0 and d_ver == 1:

        getstates()
        for l in range(0, 8):
            data[l] = data[l] / 128
        for c in range(0, 16):
            for j in range(0, 10):
                x = 0x80
                for i in range(0, 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, int(data[i])
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x >>= 1
            up()

    elif d_hor == 0 and d_ver == -1:

        getstates()
        for l in range(0, 8):
            data[l] = data[l] * 128
        while max(data) >= 1:
            for j in range(0, 10):
                x = 0x80
                for i in range(0, 8):
                    GPIO.output(latchPin, GPIO.LOW)
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, int(data[i])
                    )  #first shift data of line information to first stage 74HC959
                    LEDMatrix.shiftOut(
                        dataPin, clockPin, MSBFIRST, ~x
                    )  #then shift data of column information to second stage 74HC959
                    GPIO.output(
                        latchPin, GPIO.HIGH
                    )  # Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)  # display the next column
                    x >>= 1
            down()

    elif d_hor == 0 and d_ver == 0:

        for j in range(0, 500):
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
Example #8
0
def main():
    f = random.randint(0, 3)
    if f == 0:
        Farbe = 'Kreuz'
    elif f == 1:
        Farbe = 'Karo'
    elif f == 2:
        Farbe = 'Pik'
    elif f == 3:
        Farbe = 'Herz'
    print(Farbe)
    Z = random.randint(2, 14)
    if Z == 14:
        Zahl = 'ASS'
    elif Z == 13:
        Zahl = 'Koenig'
    elif Z == 12:
        Zahl = 'Dame'
    elif Z == 11:
        Zahl = 'Bube'
    else:
        Zahl = str(Z)
    print(Zahl)
    if Farbe == 'Kreuz':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataKreuz[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Farbe == 'Karo':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataKaro[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Farbe == 'Herz':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataHerz[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Farbe == 'Pik':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataPik[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1

    if Zahl == '2':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data2[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '3':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data3[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '4':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data4[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '5':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data5[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '6':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data6[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '7':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data7[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '8':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data8[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '9':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data9[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == '10':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data1[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data0[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == 'Bube':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataB[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == 'Dame':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataD[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == 'Koenig':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataK[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif Zahl == 'ASS':
        for j in range(0, 100):
            x = 128
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataA[i]
                )  #first shift data of line information to first stage 74HC959
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
Example #9
0
def end():
    LEDMatrix.clear_all()
    exit(0)
Example #10
0
def end():
    sleep(1)
    LEDMatrix.clear_all()
    exit(0)
Example #11
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

from sys import argv
from time import sleep

import LEDMatrix
from fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT
from LEDMatrix import DIR_L, DIR_R

LEDMatrix.init()


def scroll(text, cycles=1, speed=5):
    speed = float(speed)
    LEDMatrix.scroll_message_horiz([text + "  "], cycles, speed, DIR_L,
                                   TINY_FONT)


def end():
    sleep(1)
    LEDMatrix.clear_all()
    exit(0)


def usage():
    print('\nTry: \n banner.py "your text" [cycles] [speed]')


try:
    argv.pop(0)
Example #12
0
def end():
    LEDMatrix.clear_all()
    exit(0)
Example #13
0
def Time():
    dataDay.clear()
    if time_wert()[0:3] == 'Mon':
        dataDay.append(Data.dataM)
        dataDay.append(Data.dataO)
        dataDay.append(Data.dataN)
        dataDay.append(Data.dataColon)
    elif time_wert()[0:3] == 'Tue':
        dataDay.append(Data.dataT)
        dataDay.append(Data.dataU)
        dataDay.append(Data.dataE)
        dataDay.append(Data.dataColon)
    elif time_wert()[0:3] == 'Wed':
        dataDay.append(Data.dataW)
        dataDay.append(Data.dataE)
        dataDay.append(Data.dataD)
        dataDay.append(Data.dataColon)
    elif time_wert()[0:3] == 'Thu':
        dataDay.append(Data.dataT)
        dataDay.append(Data.dataH)
        dataDay.append(Data.dataU)
        dataDay.append(Data.dataColon)
    elif time_wert()[0:3] == 'Fri':
        dataDay.append(Data.dataF)
        dataDay.append(Data.dataR)
        dataDay.append(Data.dataI)
        dataDay.append(Data.dataColon)
    elif time_wert()[0:3] == 'Sat':
        dataDay.append(Data.dataS)
        dataDay.append(Data.dataA)
        dataDay.append(Data.dataT)
        dataDay.append(Data.dataColon)
    elif time_wert()[0:3] != 'Sun':
        dataDay.append(Data.dataS)
        dataDay.append(Data.dataU)
        dataDay.append(Data.dataN) 
        dataDay.append(Data.dataColon)
    dataDate.clear()   
    if time_wert()[4] == '1':   #Tag
        dataDate.append(Data.data1)
    elif time_wert()[4] == '2':
        dataDate.append(Data.data2)
    elif time_wert()[4] == '3':
        dataDate.append(Data.data3)
    elif time_wert()[4] == '4':
        dataDate.append(Data.data4)
    elif time_wert()[4] == '5':
        dataDate.append(Data.data5)
    elif time_wert()[4] == '6':
        dataDate.append(Data.data6)
    elif time_wert()[4] == '7':
        dataDate.append(Data.data7)
    elif time_wert()[4] == '8':
        dataDate.append(Data.data8)
    elif time_wert()[4] == '9':
        dataDate.append(Data.data9)
    elif time_wert()[4] == '0':
        dataDate.append(Data.data0)
    if time_wert()[5] == '1':
        dataDate.append(Data.data1)
    elif time_wert()[5] == '2':
        dataDate.append(Data.data2)
    elif time_wert()[5] == '3':
        dataDate.append(Data.data3)
    elif time_wert()[5] == '4':
        dataDate.append(Data.data4)
    elif time_wert()[5] == '5':
        dataDate.append(Data.data5)
    elif time_wert()[5] == '6':
        dataDate.append(Data.data6)
    elif time_wert()[5] == '7':
        dataDate.append(Data.data7)
    elif time_wert()[5] == '8':
        dataDate.append(Data.data8)
    elif time_wert()[5] == '9':
        dataDate.append(Data.data9)
    elif time_wert()[5] == '0':
        dataDate.append(Data.data0)
    dataDate.append(Data.dataDot)
    if time_wert()[7] == '1':    #Monat
        dataDate.append(Data.data1)
    elif time_wert()[7] == '2':
        dataDate.append(Data.data2)
    elif time_wert()[7] == '3':
        dataDate.append(Data.data3)
    elif time_wert()[7] == '4':
        dataDate.append(Data.data4)
    elif time_wert()[7] == '5':
        dataDate.append(Data.data5)
    elif time_wert()[7] == '6':
        dataDate.append(Data.data6)
    elif time_wert()[7] == '7':
        dataDate.append(Data.data7)
    elif time_wert()[7] == '8':
        dataDate.append(Data.data8)
    elif time_wert()[7] == '9':
        dataDate.append(Data.data9)
    elif time_wert()[7] == '0':
        dataDate.append(Data.data0)
    if time_wert()[8] == '1':
        dataDate.append(Data.data1)
    elif time_wert()[8] == '2':
        dataDate.append(Data.data2)
    elif time_wert()[8] == '3':
        dataDate.append(Data.data3)
    elif time_wert()[8] == '4':
        dataDate.append(Data.data4)
    elif time_wert()[8] == '5':
        dataDate.append(Data.data5)
    elif time_wert()[8] == '6':
        dataDate.append(Data.data6)
    elif time_wert()[8] == '7':
        dataDate.append(Data.data7)
    elif time_wert()[8] == '8':
        dataDate.append(Data.data8)
    elif time_wert()[8] == '9':
        dataDate.append(Data.data9)
    elif time_wert()[8] == '0':
        dataDate.append(Data.data0)
    dataDate.append(Data.dataDot)
    dataDate.append(Data.data1)
    dataDate.append(Data.data8)
    dataTime.clear()   
    if time_wert()[13] == '1':    #Stunde
        dataTime.append(Data.data1)
    elif time_wert()[13] == '2':
        dataTime.append(Data.data2)
    elif time_wert()[13] == '3':
        dataTime.append(Data.data3)
    elif time_wert()[13] == '4':
        dataTime.append(Data.data4)
    elif time_wert()[13] == '5':
        dataTime.append(Data.data5)
    elif time_wert()[13] == '6':
        dataTime.append(Data.data6)
    elif time_wert()[13] == '7':
        dataTime.append(Data.data7)
    elif time_wert()[13] == '8':
        dataTime.append(Data.data8)
    elif time_wert()[13] == '9':
        dataTime.append(Data.data9)
    elif time_wert()[13] == '0':
        dataTime.append(Data.data0)
    if time_wert()[14] == '1':
        dataTime.append(Data.data1)
    elif time_wert()[14] == '2':
        dataTime.append(Data.data2)
    elif time_wert()[14] == '3':
        dataTime.append(Data.data3)
    elif time_wert()[14] == '4':
        dataTime.append(Data.data4)
    elif time_wert()[14] == '5':
        dataTime.append(Data.data5)
    elif time_wert()[14] == '6':
        dataTime.append(Data.data6)
    elif time_wert()[14] == '7':
        dataTime.append(Data.data7)
    elif time_wert()[14] == '8':
        dataTime.append(Data.data8)
    elif time_wert()[14] == '9':
        dataTime.append(Data.data9)
    elif time_wert()[14] == '0':
        dataTime.append(Data.data0)
    dataTime.append(Data.dataColon)
    if time_wert()[16] == '1':     #Minute
        dataTime.append(Data.data1)
    elif time_wert()[16] == '2':
        dataTime.append(Data.data2)
    elif time_wert()[16] == '3':
        dataTime.append(Data.data3)
    elif time_wert()[16] == '4':
        dataTime.append(Data.data4)
    elif time_wert()[16] == '5':
        dataTime.append(Data.data5)
    elif time_wert()[16] == '6':
        dataTime.append(Data.data6)
    elif time_wert()[16] == '7':
        dataTime.append(Data.data7)
    elif time_wert()[16] == '8':
        dataTime.append(Data.data8)
    elif time_wert()[16] == '9':
        dataTime.append(Data.data9)
    elif time_wert()[16] == '0':
        dataTime.append(Data.data0)
    if time_wert()[17] == '1':
        dataTime.append(Data.data1)
    elif time_wert()[17] == '2':
        dataTime.append(Data.data2)
    elif time_wert()[17] == '3':
        dataTime.append(Data.data3)
    elif time_wert()[17] == '4':
        dataTime.append(Data.data4)
    elif time_wert()[17] == '5':
        dataTime.append(Data.data5)
    elif time_wert()[17] == '6':
        dataTime.append(Data.data6)
    elif time_wert()[17] == '7':
        dataTime.append(Data.data7)
    elif time_wert()[17] == '8':
        dataTime.append(Data.data8)
    elif time_wert()[17] == '9':
        dataTime.append(Data.data9)
    elif time_wert()[17] == '0':
        dataTime.append(Data.data0)
    dataTime.append(Data.dataColon)
    if time_wert()[19] == '1':    #Sekunde
        dataTime.append(Data.data1)
    elif time_wert()[19] == '2':
        dataTime.append(Data.data2)
    elif time_wert()[19] == '3':
        dataTime.append(Data.data3)
    elif time_wert()[19] == '4':
        dataTime.append(Data.data4)
    elif time_wert()[19] == '5':
        dataTime.append(Data.data5)
    elif time_wert()[19] == '6':
        dataTime.append(Data.data6)
    elif time_wert()[19] == '7':
        dataTime.append(Data.data7)
    elif time_wert()[19] == '8':
        dataTime.append(Data.data8)
    elif time_wert()[19] == '9':
        dataTime.append(Data.data9)
    elif time_wert()[19] == '0':
        dataTime.append(Data.data0)
    if time_wert()[20] == '1':
        dataTime.append(Data.data1)
    elif time_wert()[20] == '2':
        dataTime.append(Data.data2)
    elif time_wert()[20] == '3':
        dataTime.append(Data.data3)
    elif time_wert()[20] == '4':
        dataTime.append(Data.data4)
    elif time_wert()[20] == '5':
        dataTime.append(Data.data5)
    elif time_wert()[20] == '6':
        dataTime.append(Data.data6)
    elif time_wert()[20] == '7':
        dataTime.append(Data.data7)
    elif time_wert()[20] == '8':
        dataTime.append(Data.data8)
    elif time_wert()[20] == '9':
        dataTime.append(Data.data9)
    elif time_wert()[20] == '0':
        dataTime.append(Data.data0) 
    
    time.sleep(1)
    for m in range(0,4):
        for k in range(0,len(dataDay[m])-8):
            for j in range(0,5):
                x=0x80
                for i in range(k,k+8):
                    GPIO.output(latchPin,GPIO.LOW)
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,dataDay[m][i]) #first shift data of line information to first stage 74HC959   
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column information to second stage 74HC959
                    GPIO.output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)# display the next column
                    x>>=1
    for m in range(0,8):
        for k in range(0,len(dataDate[m])-8):
            for j in range(0,5):
                x=0x80
                for i in range(k,k+8):
                    GPIO.output(latchPin,GPIO.LOW)
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,dataDate[m][i]) #first shift data of line information to first stage 74HC959   
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column information to second stage 74HC959
                    GPIO.output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)# display the next column
                    x>>=1
    time.sleep(0.5)
    for m in range(0,8):
        for k in range(0,len(dataTime[m])-8):
            for j in range(0,5):
                x=0x80
                for i in range(k,k+8):
                    GPIO.output(latchPin,GPIO.LOW)
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,dataTime[m][i]) #first shift data of line information to first stage 74HC959   
                    LEDMatrix.shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column information to second stage 74HC959
                    GPIO.output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the same time
                    time.sleep(0.001)# display the next column
                    x>>=1
Example #14
0
def end():
    sleep(1)
    LEDMatrix.clear_all()
    exit(0)
Example #15
0
def scroll(text, cycles=1, speed=5):
    speed=float(speed)
    LEDMatrix.scroll_message_horiz([text + "  "], cycles, speed, DIR_L, TINY_FONT)
Example #16
0
def destroy():
    root.destroy()
    LEDMatrix.destroy()
Example #17
0
import spidev
import time
import sys
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from PIL import ImageChops
import LEDMatrix

matrix = LEDMatrix.LEDMatrix()

text = (("Raspberry Pi ", (255, 0, 0)), ("and ", (0, 255, 0)), ("Adafruit",
                                                                (0, 0, 255)))

font = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf",
                          16)
all_text = ""
for text_color_pair in text:
    t = text_color_pair[0]
    all_text = all_text + t

print(all_text)
width, ignore = font.getsize(all_text)
print(width)

im = Image.new("RGB", (width + 30, 64), "black")
draw = ImageDraw.Draw(im)

x = 0
for text_color_pair in text:
    t = text_color_pair[0]
Example #18
0
import LEDMatrix
import time
import pickle
import socket

LEDMatrix.init("COM4")
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('127.0.0.1', 5005))

chord = [1, 6, 2, 5]
chord_idx = 0
while True:
    received = sock.recv(1024)

    if len(received) > 0:
        data = pickle.loads(received)

        if data['instrument'] == 'harmony':
            LEDMatrix.send_update(0, data['chord'][1], data['chord'][0])
            #print("Harmony data: {}".format(data['chord']))
        elif data['instrument'] == 'bass':
            LEDMatrix.send_update(1, data['chord'][1], data['chord'][0])
            #print("Bassline data: {}".format(data['chord']))
        #elif data['instrument'] == 'melody':
        #    LEDMatrix.send_update(2, (255, 255), [data['note'], 255, 255])
        #    print("Melody data: {}".format(data['note']))
Example #19
0
def scroll(text, cycles=1, speed=5):
    speed = float(speed)
    LEDMatrix.scroll_message_horiz([text + "  "], cycles, speed, DIR_L,
                                   TINY_FONT)
Example #20
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

from time import sleep, strftime
import LEDMatrix
from fonts import TINY_FONT
from LEDMatrix import DIR_RD, DIR_L

LEDMatrix.init()

def tick():
    while True:
        date = strftime('%a') + " " + strftime('%x')
        LEDMatrix.scroll_message_horiz([date], 1, 5, DIR_L, TINY_FONT)
        sleep(1)
        cycle = 1
        while cycle < 80:
            H = strftime('%H')
            M = strftime('%M')
            S = strftime('%S')
            LEDMatrix.static_message(H+M+S, DIR_RD, 0, TINY_FONT)
            cycle += 1
            sleep(0.5)

def end():
    LEDMatrix.clear_all()
    exit(0)

try:
    tick()
Example #21
0
def cpu_temp():
    t = float(get_cpu_temp())
    time.sleep(0.01)
    tempC = str(t) + ' C'
    time.sleep(0.01)
    tempF = str(t * 9 / 5 + 32) + ' F'
    time.sleep(0.01)
    tempK = str('{:.2f}'.format(t + 273.15)) + ' K'
    time.sleep(0.01)
    print('1 = Grad Celsius')
    print('2 = Grad Fahrenheit')
    print('3 = Kelvin')
    if LEDMatrix.Num:
        while True:
            keypad = Keypad.Keypad(keys, rowsPins, colsPins, ROWS, COLS)
            keypad.setDebounceTime(50)
            key = keypad.getKey()
            if key == '1':
                dataT.clear()
                if tempC[0] == '1':
                    dataT.append(Data.data1)
                elif tempC[0] == '2':
                    dataT.append(Data.data2)
                elif tempC[0] == '3':
                    dataT.append(Data.data3)
                elif tempC[0] == '4':
                    dataT.append(Data.data4)
                elif tempC[0] == '5':
                    dataT.append(Data.data5)
                elif tempC[0] == '6':
                    dataT.append(Data.data6)
                elif tempC[0] == '7':
                    dataT.append(Data.data7)
                elif tempC[0] == '8':
                    dataT.append(Data.data8)
                elif tempC[0] == '9':
                    dataT.append(Data.data9)
                elif tempC[0] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempC[1] == '1':
                    dataT.append(Data.data1)
                elif tempC[1] == '2':
                    dataT.append(Data.data2)
                elif tempC[1] == '3':
                    dataT.append(Data.data3)
                elif tempC[1] == '4':
                    dataT.append(Data.data4)
                elif tempC[1] == '5':
                    dataT.append(Data.data5)
                elif tempC[1] == '6':
                    dataT.append(Data.data6)
                elif tempC[1] == '7':
                    dataT.append(Data.data7)
                elif tempC[1] == '8':
                    dataT.append(Data.data8)
                elif tempC[1] == '9':
                    dataT.append(Data.data9)
                elif tempC[1] == '0':
                    dataT.append(Data.data0)
                dataT.append(Data.dataDot)
                time.sleep(0.1)
                if tempC[3] == '1':
                    dataT.append(Data.data1)
                elif tempC[3] == '2':
                    dataT.append(Data.data2)
                elif tempC[3] == '3':
                    dataT.append(Data.data3)
                elif tempC[3] == '4':
                    dataT.append(Data.data4)
                elif tempC[3] == '5':
                    dataT.append(Data.data5)
                elif tempC[3] == '6':
                    dataT.append(Data.data6)
                elif tempC[3] == '7':
                    dataT.append(Data.data7)
                elif tempC[3] == '8':
                    dataT.append(Data.data8)
                elif tempC[3] == '9':
                    dataT.append(Data.data9)
                elif tempC[3] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempC[4] == '1':
                    dataT.append(Data.data1)
                elif tempC[4] == '2':
                    dataT.append(Data.data2)
                elif tempC[4] == '3':
                    dataT.append(Data.data3)
                elif tempC[4] == '4':
                    dataT.append(Data.data4)
                elif tempC[4] == '5':
                    dataT.append(Data.data5)
                elif tempC[4] == '6':
                    dataT.append(Data.data6)
                elif tempC[4] == '7':
                    dataT.append(Data.data7)
                elif tempC[4] == '8':
                    dataT.append(Data.data8)
                elif tempC[4] == '9':
                    dataT.append(Data.data9)
                elif tempC[4] == '0':
                    dataT.append(Data.data0)
                dataT.append(Data.dataDeg)
                dataT.append(Data.dataC)
                time.sleep(1)
                for m in range(0, 7):
                    for k in range(0, len(dataT[m]) - 8):
                        for j in range(0, 5):
                            x = 0x80
                            for i in range(k, k + 8):
                                GPIO.output(latchPin, GPIO.LOW)
                                LEDMatrix.shiftOut(
                                    dataPin, clockPin, MSBFIRST, dataT[m][i]
                                )  #first shift data of line information to first stage 74HC959
                                LEDMatrix.shiftOut(
                                    dataPin, clockPin, MSBFIRST, ~x
                                )  #then shift data of column information to second stage 74HC959
                                GPIO.output(
                                    latchPin, GPIO.HIGH
                                )  # Output data of two stage 74HC595 at the same time
                                time.sleep(0.001)  # display the next column
                                x >>= 1
                break
            elif key == '2':
                dataT.clear()
                if tempF[0] == '1':
                    dataT.append(Data.data1)
                elif tempF[0] == '2':
                    dataT.append(Data.data2)
                elif tempF[0] == '3':
                    dataT.append(Data.data3)
                elif tempF[0] == '4':
                    dataT.append(Data.data4)
                elif tempF[0] == '5':
                    dataT.append(Data.data5)
                elif tempF[0] == '6':
                    dataT.append(Data.data6)
                elif tempF[0] == '7':
                    dataT.append(Data.data7)
                elif tempF[0] == '8':
                    dataT.append(Data.data8)
                elif tempF[0] == '9':
                    dataT.append(Data.data9)
                elif tempF[0] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempF[1] == '1':
                    dataT.append(Data.data1)
                elif tempF[1] == '2':
                    dataT.append(Data.data2)
                elif tempF[1] == '3':
                    dataT.append(Data.data3)
                elif tempF[1] == '4':
                    dataT.append(Data.data4)
                elif tempF[1] == '5':
                    dataT.append(Data.data5)
                elif tempF[1] == '6':
                    dataT.append(Data.data6)
                elif tempF[1] == '7':
                    dataT.append(Data.data7)
                elif tempF[1] == '8':
                    dataT.append(Data.data8)
                elif tempF[1] == '9':
                    dataT.append(Data.data9)
                elif tempF[1] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempF[2] == '1':
                    dataT.append(Data.data1)
                elif tempF[2] == '2':
                    dataT.append(Data.data2)
                elif tempF[2] == '3':
                    dataT.append(Data.data3)
                elif tempF[2] == '4':
                    dataT.append(Data.data4)
                elif tempF[2] == '5':
                    dataT.append(Data.data5)
                elif tempF[2] == '6':
                    dataT.append(Data.data6)
                elif tempF[2] == '7':
                    dataT.append(Data.data7)
                elif tempF[2] == '8':
                    dataT.append(Data.data8)
                elif tempF[2] == '9':
                    dataT.append(Data.data9)
                elif tempF[2] == '0':
                    dataT.append(Data.data0)
                dataT.append(Data.dataDot)
                time.sleep(0.1)
                if tempF[4] == '1':
                    dataT.append(Data.data1)
                elif tempF[4] == '2':
                    dataT.append(Data.data2)
                elif tempF[4] == '3':
                    dataT.append(Data.data3)
                elif tempF[4] == '4':
                    dataT.append(Data.data4)
                elif tempF[4] == '5':
                    dataT.append(Data.data5)
                elif tempF[4] == '6':
                    dataT.append(Data.data6)
                elif tempF[4] == '7':
                    dataT.append(Data.data7)
                elif tempF[4] == '8':
                    dataT.append(Data.data8)
                elif tempF[4] == '9':
                    dataT.append(Data.data9)
                elif tempF[4] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempF[5] == '1':
                    dataT.append(Data.data1)
                elif tempF[5] == '2':
                    dataT.append(Data.data2)
                elif tempF[5] == '3':
                    dataT.append(Data.data3)
                elif tempF[5] == '4':
                    dataT.append(Data.data4)
                elif tempF[5] == '5':
                    dataT.append(Data.data5)
                elif tempF[5] == '6':
                    dataT.append(Data.data6)
                elif tempF[5] == '7':
                    dataT.append(Data.data7)
                elif tempF[5] == '8':
                    dataT.append(Data.data8)
                elif tempF[5] == '9':
                    dataT.append(Data.data9)
                elif tempF[5] == '0':
                    dataT.append(Data.data0)
                dataT.append(Data.dataDeg)
                dataT.append(Data.dataF)
                time.sleep(1)
                for m in range(0, 8):
                    for k in range(0, len(dataT[m]) - 8):
                        for j in range(0, 5):
                            x = 0x80
                            for i in range(k, k + 8):
                                GPIO.output(latchPin, GPIO.LOW)
                                LEDMatrix.shiftOut(
                                    dataPin, clockPin, MSBFIRST, dataT[m][i]
                                )  #first shift data of line information to first stage 74HC959
                                LEDMatrix.shiftOut(
                                    dataPin, clockPin, MSBFIRST, ~x
                                )  #then shift data of column information to second stage 74HC959
                                GPIO.output(
                                    latchPin, GPIO.HIGH
                                )  # Output data of two stage 74HC595 at the same time
                                time.sleep(0.001)  # display the next column
                                x >>= 1
                break
            elif key == '3':
                dataT.clear()
                if tempK[0] == '1':
                    dataT.append(Data.data1)
                elif tempK[0] == '2':
                    dataT.append(Data.data2)
                elif tempK[0] == '3':
                    dataT.append(Data.data3)
                elif tempK[0] == '4':
                    dataT.append(Data.data4)
                elif tempK[0] == '5':
                    dataT.append(Data.data5)
                elif tempK[0] == '6':
                    dataT.append(Data.data6)
                elif tempK[0] == '7':
                    dataT.append(Data.data7)
                elif tempK[0] == '8':
                    dataT.append(Data.data8)
                elif tempK[0] == '9':
                    dataT.append(Data.data9)
                elif tempK[0] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempK[1] == '1':
                    dataT.append(Data.data1)
                elif tempK[1] == '2':
                    dataT.append(Data.data2)
                elif tempK[1] == '3':
                    dataT.append(Data.data3)
                elif tempK[1] == '4':
                    dataT.append(Data.data4)
                elif tempK[1] == '5':
                    dataT.append(Data.data5)
                elif tempK[1] == '6':
                    dataT.append(Data.data6)
                elif tempK[1] == '7':
                    dataT.append(Data.data7)
                elif tempK[1] == '8':
                    dataT.append(Data.data8)
                elif tempK[1] == '9':
                    dataT.append(Data.data9)
                elif tempK[1] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempF[2] == '1':
                    dataT.append(Data.data1)
                elif tempF[2] == '2':
                    dataT.append(Data.data2)
                elif tempF[2] == '3':
                    dataT.append(Data.data3)
                elif tempF[2] == '4':
                    dataT.append(Data.data4)
                elif tempF[2] == '5':
                    dataT.append(Data.data5)
                elif tempF[2] == '6':
                    dataT.append(Data.data6)
                elif tempF[2] == '7':
                    dataT.append(Data.data7)
                elif tempF[2] == '8':
                    dataT.append(Data.data8)
                elif tempF[2] == '9':
                    dataT.append(Data.data9)
                elif tempF[2] == '0':
                    dataT.append(Data.data0)
                dataT.append(Data.dataDot)
                time.sleep(0.1)
                if tempK[4] == '1':
                    dataT.append(Data.data1)
                elif tempK[4] == '2':
                    dataT.append(Data.data2)
                elif tempK[4] == '3':
                    dataT.append(Data.data3)
                elif tempK[4] == '4':
                    dataT.append(Data.data4)
                elif tempK[4] == '5':
                    dataT.append(Data.data5)
                elif tempK[4] == '6':
                    dataT.append(Data.data6)
                elif tempK[4] == '7':
                    dataT.append(Data.data7)
                elif tempK[4] == '8':
                    dataT.append(Data.data8)
                elif tempK[4] == '9':
                    dataT.append(Data.data9)
                elif tempK[4] == '0':
                    dataT.append(Data.data0)
                time.sleep(0.1)
                if tempK[5] == '1':
                    dataT.append(Data.data1)
                elif tempK[5] == '2':
                    dataT.append(Data.data2)
                elif tempK[5] == '3':
                    dataT.append(Data.data3)
                elif tempK[5] == '4':
                    dataT.append(Data.data4)
                elif tempK[5] == '5':
                    dataT.append(Data.data5)
                elif tempK[5] == '6':
                    dataT.append(Data.data6)
                elif tempK[5] == '7':
                    dataT.append(Data.data7)
                elif tempK[5] == '8':
                    dataT.append(Data.data8)
                elif tempK[5] == '9':
                    dataT.append(Data.data9)
                elif tempK[5] == '0':
                    dataT.append(Data.data0)
                dataT.append(Data.dataDeg)
                dataT.append(Data.dataK)
                time.sleep(1)
                for m in range(0, 8):
                    for k in range(0, len(dataT[m]) - 8):
                        for j in range(0, 5):
                            x = 0x80
                            for i in range(k, k + 8):
                                GPIO.output(latchPin, GPIO.LOW)
                                LEDMatrix.shiftOut(
                                    dataPin, clockPin, MSBFIRST, dataT[m][i]
                                )  #first shift data of line information to first stage 74HC959
                                LEDMatrix.shiftOut(
                                    dataPin, clockPin, MSBFIRST, ~x
                                )  #then shift data of column information to second stage 74HC959
                                GPIO.output(
                                    latchPin, GPIO.HIGH
                                )  # Output data of two stage 74HC595 at the same time
                                time.sleep(0.001)  # display the next column
                                x >>= 1
                print("# = Diese Liste")
                print("* = beenden")
                print("A = Taschenrechner")
                print("B = Dez-Bin-Hex-Rechner")
                print("C = GUI")
                print("1 = wuerfeln (16-seitig)")
                print("2 = Zeit anzeigen")
                print("3 = Display CPU-Temp")
                print("4 = 'snake'")
                print("5 = 'snake-game'")
                print("6 = 'matrix'")
                print("7 = matrix2'")
                print("8 = random Punkt")
                print("9 = 'Bislschirmschoner'")
                print("0 = Karte ziehen")
                break
Example #22
0
def zufall():
    for k in range(0,
                   len(Data.data) -
                   8):  #len(data) total number of "0-F" columns
        for j in range(
                0, 5
        ):  # times of repeated displaying LEDMatrix in every frame, the bigger the "j", the longer the display time.
            x = 0x80  # Set the column information to start from the first column
            for i in range(k, k + 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(dataPin, clockPin, MSBFIRST, Data.data[i])
                LEDMatrix.shiftOut(dataPin, clockPin, MSBFIRST, ~x)
                GPIO.output(latchPin, GPIO.HIGH)
                time.sleep(0.001)
                x >>= 1
    zahl = random.randint(0, 15)
    if zahl == 0:
        for j in range(
                0, 20
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data0[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 1:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data1[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 2:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data2[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 3:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data3[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 4:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data4[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 5:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data5[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 6:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data6[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 7:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data7[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 8:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data8[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 9:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, data9[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 10:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataA[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 11:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataB[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 12:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataC[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 13:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataD[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 14:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataE[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1
    elif zahl == 15:
        for j in range(
                0, 500
        ):  # Repeat enough times to display the smiling face a period of time
            x = 0x80
            for i in range(0, 8):
                GPIO.output(latchPin, GPIO.LOW)
                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, dataF[i]
                )  #first shift data of line information to first stage 74HC959

                LEDMatrix.shiftOut(
                    dataPin, clockPin, MSBFIRST, ~x
                )  #then shift data of column information to second stage 74HC959
                GPIO.output(
                    latchPin, GPIO.HIGH
                )  # Output data of two stage 74HC595 at the same time
                time.sleep(0.001)  # display the next column
                x >>= 1