Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LEDMatrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teckids
Projekt Hack-n-Fun
Material und Vorlagen
LEDMatrix
Commits
50c7b8ef
Commit
50c7b8ef
authored
1 year ago
by
Martin Winter
Browse files
Options
Downloads
Patches
Plain Diff
remove some bugs
parent
1d35f97d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
animations.py
+41
-10
41 additions, 10 deletions
animations.py
font8x8.py
+1
-1
1 addition, 1 deletion
font8x8.py
pictures.py
+12
-3
12 additions, 3 deletions
pictures.py
with
54 additions
and
14 deletions
animations.py
+
41
−
10
View file @
50c7b8ef
...
...
@@ -16,7 +16,7 @@ def scroll(message, duration=5, speed = 15):
frame
=
get_picture
(
"
clear
"
)
while
time
()
-
start
<=
duration
:
shift_left
(
frame
,
get_column
(
letter
(
message
[
lettercounter
]),
7
-
colcounter
))
shift_left
(
frame
,
get_column
(
letter
(
message
[
lettercounter
]),
colcounter
))
shield
.
blit
(
frame
,
(
0
,
0
))
if
colcounter
<
7
:
...
...
@@ -66,7 +66,28 @@ def rustle(duration=5, speed = 10):
shield
.
update
()
sleep
(
1
/
speed
)
def
matrix
(
duration
=
10
,
speed
=
5
):
shield
.
clear
()
shield
.
update
()
display
=
get_picture
(
"
clear
"
)
start
=
time
()
row
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
while
time
()
-
start
<=
duration
:
for
i
in
range
(
8
):
row
[
i
]
=
getrandbits
(
1
)
#rand = getrandbits(2)
#if rand == 0:
#row[i] = int(not row[i])
print
(
row
)
sleep
(
1
/
2
)
shift_down
(
display
,
row
)
shield
.
blit
(
display
)
shield
.
update
()
sleep
(
1
/
speed
)
def
arrows
(
duration
=
5
,
direction
=
"
right
"
,
speed
=
10
):
shield
.
clear
()
shield
.
update
()
...
...
@@ -81,9 +102,9 @@ def arrows(duration=5, direction = "right", speed = 10):
start
=
time
()
while
time
()
-
start
<=
duration
:
if
direction
==
"
right
"
:
shift_right
(
arrow
,
get_column
(
arrow
,
0
))
shift_right
(
arrow
,
get_column
(
arrow
,
7
))
elif
direction
==
"
left
"
:
shift_left
(
arrow
,
get_column
(
arrow
,
7
))
shift_left
(
arrow
,
get_column
(
arrow
,
0
))
elif
direction
==
"
up
"
:
shift_up
(
arrow
,
arrow
[
0
])
else
:
...
...
@@ -93,6 +114,9 @@ def arrows(duration=5, direction = "right", speed = 10):
shield
.
update
()
sleep
(
1
/
speed
)
def
get_row
(
bitmap
:
list
[
list
[
int
|
bool
]],
rownumber
:
int
):
row
=
bitmap
[
rownumber
]
return
row
def
get_column
(
bitmap
:
list
[
list
[
int
|
bool
]],
colnumber
:
int
):
col
=
[]
...
...
@@ -112,17 +136,24 @@ def shift_down(bitmap: list[list[int | bool]],
bitmap
.
insert
(
0
,
row
)
def
shift_left
(
bitmap
:
list
[
list
[
int
|
bool
]],
row
:
list
[
int
|
bool
]
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]):
col
:
list
[
int
|
bool
]
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]):
for
i
in
range
(
len
(
bitmap
)):
bitmap
[
i
].
pop
(
-
1
)
bitmap
[
i
].
insert
(
0
,
row
[
i
])
bitmap
[
i
].
pop
(
0
)
bitmap
[
i
].
append
(
col
[
i
])
def
shift_right
(
bitmap
:
list
[
list
[
int
|
bool
]],
row
:
list
[
int
|
bool
]
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]):
col
:
list
[
int
|
bool
]
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]):
for
i
in
range
(
len
(
bitmap
)):
bitmap
[
i
].
pop
(
0
)
bitmap
[
i
].
append
(
row
[
i
])
bitmap
[
i
].
pop
(
-
1
)
bitmap
[
i
].
insert
(
0
,
col
[
i
])
if
__name__
==
"
__main__
"
:
while
True
:
random
()
\ No newline at end of file
#scroll("Hallo Welt!",10)
#arrows(5)
#arrows(5, "left", 20)
#arrows(5, "up", 20)
#arrows(5, "down")
#rustle()
matrix
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
font8x8.py
+
1
−
1
View file @
50c7b8ef
...
...
@@ -17,7 +17,7 @@ def byte_to_bits(byte):
while
len
(
bits
)
<=
8
:
bits
.
insert
(
0
,
0
)
return
bits
return
bits
[::
-
1
]
def
letter
(
letter
):
return
bytes_to_bitsarray
(
font
[
letter
])
...
...
This diff is collapsed.
Click to expand it.
pictures.py
+
12
−
3
View file @
50c7b8ef
from
myfrabuled
import
WEMOSMatrixLEDShield
from
time
import
sleep
,
time
,
ticks_ms
def
get_picture
(
pic
):
picture
=
[[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
...
...
@@ -53,7 +56,7 @@ pictures = {
[
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
],
[
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
],
[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
]],
'
l
_arrow
'
:
[[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
],
'
r
_arrow
'
:
[[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
],
[
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
],
[
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
],
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
...
...
@@ -61,7 +64,7 @@ pictures = {
[
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
],
[
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
],
[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
]],
'
r
_arrow
'
:
[[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
],
'
l
_arrow
'
:
[[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
],
[
0
,
0
,
1
,
1
,
0
,
0
,
0
,
0
],
[
0
,
1
,
1
,
0
,
0
,
0
,
0
,
0
],
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
...
...
@@ -85,4 +88,10 @@ pictures = {
[
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
],
[
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
],
[
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
]]
}
\ No newline at end of file
}
if
__name__
==
"
__main__
"
:
shield
=
WEMOSMatrixLEDShield
()
shield
.
blit
(
pictures
[
'
l_arrow
'
])
shield
.
update
()
sleep
(
0.8
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment