I have a little issue with my python script.
Actually, I'm working on real led matrix 8x8 and I want to draw a text with animation (right to left, left to right, up to down, down to up).
For example, I want to write the E letter. So I created the E matrix:
matrix =[
"1","1","1","1","1","1","1","1",
"1","1","1","1","1","1","1","1",
"1","1","0","0","0","0","0","0",
"1","1","1","1","1","0","0","0",
"1","1","1","1","1","0","0","0",
"1","1","0","0","0","0","0","0",
"1","1","1","1","1","1","1","1",
"1","1","1","1","1","1","1","1"]
But now, imagine I want to move my E to make animation. If I move my E to the left, the eighth column will be empty, and after 1s, the seventh too etc... And when my matrix will be completely empty, my E letter will start in right position again...
Do you have an idea how can I do that with array, matrix or whatever?
Thank you
EDIT, code test with https://www.jdoodle.com/python3-programming-online:
matrix = [ [0, 0, 0, 1, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 1, 0]]
print(matrix)
def shift(my2dArray):
for _ in range(5): # shift to the left 8 times - brute force
for row in my2dArray:
row.pop(0) # removes first element of each row
row.append("0") # add "0" to the end of the row
# code to update display here and sleep for a bit
shift(matrix)
print(matrix)