Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
blobfox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Roxy
blobfox
Commits
e228cd53
Commit
e228cd53
authored
1 year ago
by
Roxy
Browse files
Options
Downloads
Patches
Plain Diff
added LEDs with colors for blobfoxes
parent
eb1be5b4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
flow3r.toml
+1
-1
1 addition, 1 deletion
flow3r.toml
main.py
+123
-17
123 additions, 17 deletions
main.py
with
124 additions
and
18 deletions
flow3r.toml
+
1
−
1
View file @
e228cd53
...
...
@@ -17,7 +17,7 @@ author = "Roxy"
license
=
"MIT"
# URL to the repository of your app.
url
=
"
https://git.flow3r.garden/r
oxy/blobfox"
url
=
"
R
oxy/blobfox"
# Description of your app. Maximum 140 characters!
description
=
"express your emotions with blobfoxes and the leds"
...
...
This diff is collapsed.
Click to expand it.
main.py
+
123
−
17
View file @
e228cd53
...
...
@@ -17,6 +17,60 @@ from st3m.reactor import Responder
from
ctx
import
Context
import
st3m.run
import
leds
button_leds
=
[
[
37
,
38
,
39
,
0
,
1
,
2
,
3
],
# top north
[
2
,
3
,
4
,
5
,
6
],
# buttom north east
[
5
,
6
,
7
,
8
,
9
,
10
,
11
],
# top east
[
10
,
11
,
12
,
13
,
14
],
# buttom east
[
13
,
14
,
15
,
16
,
17
,
18
,
19
],
# top south east
[
18
,
19
,
20
,
21
,
22
],
# buttom south
[
21
,
22
,
23
,
24
,
25
,
26
,
27
],
# top south west
[
26
,
27
,
28
,
29
,
30
],
# buttom west
[
29
,
30
,
31
,
32
,
33
,
34
,
35
],
# top west
[
34
,
35
,
36
,
37
,
38
],
# buttom north west
]
emoji_colors
=
{
# happy
'
1f642
'
:
(
255
,
255
,
0
),
'
1f600
'
:
(
255
,
215
,
0
),
# grinning
'
1f60c
'
:
(
255
,
0
,
0
),
# relieved
'
1f63a
'
:
(
255
,
0
,
255
),
# smile cat
'
1f60a
'
:
(
255
,
0
,
127
),
# blush
'
1f604
'
:
(
255
,
127
,
0
),
# eyes closed smile
# laugh
'
1f603
'
:
(
255
,
255
,
0
),
'
1f602
'
:
(
202
,
34
,
96
),
# tears of joy
'
1f606
'
:
(
255
,
215
,
0
),
# grin
'
1f639
'
:
(
255
,
0
,
255
),
# tears of joy cat
'
1f92a
'
:
(
255
,
0
,
127
),
# crazy
'
1f973
'
:
(
255
,
127
,
0
),
# party
# cool
'
1f60e
'
:
(
0
,
0
,
255
),
'
1f607
'
:
(
255
,
200
,
220
),
# halo
'
1f974
'
:
(
255
,
215
,
0
),
# weird
'
1f92a
'
:
(
255
,
0
,
255
),
# crazy
'
1f973
'
:
(
255
,
0
,
127
),
# party
'
1f608
'
:
(
255
,
0
,
255
),
# evil
# sad
'
1f615
'
:
(
0
,
0
,
255
),
'
1f614
'
:
(
255
,
215
,
0
),
# pensive
'
1f61e
'
:
(
202
,
34
,
96
),
# disappointed
'
1f622
'
:
(
255
,
0
,
255
),
# cry
'
1f62d
'
:
(
255
,
0
,
127
),
# cry cat
'
1f62a
'
:
(
255
,
127
,
0
),
# angry
# love
'
1f970
'
:
(
255
,
0
,
255
),
'
1f60d
'
:
(
240
,
40
,
0
),
# heart eyes
'
1f618
'
:
(
240
,
0
,
40
),
# heart kiss
'
1f63b
'
:
(
255
,
0
,
0
),
# heart eyes cat
'
1f619
'
:
(
140
,
0
,
20
),
# closed eyed kiss
'
1f917
'
:
(
255
,
100
,
100
),
# hug
}
top_menu_emojis
=
[
'
blobfox
'
,
# happy
'
blobfoxhappy
'
,
# laugh
...
...
@@ -63,6 +117,58 @@ sub_menu_emojis = [
],
]
emoji_colors
=
{
# happy
'
blobfox
'
:
(
255
,
255
,
0
),
'
blobfoxhappy
'
:
(
255
,
215
,
0
),
'
blobfoxhappymlem
'
:
(
255
,
0
,
0
),
'
blobfoxreachaww
'
:
(
255
,
0
,
255
),
'
blobfoxmischievous
'
:
(
255
,
0
,
127
),
'
blobfoxsnug
'
:
(
255
,
127
,
0
),
# laugh
'
blobfoxlaugh
'
:
(
255
,
255
,
0
),
'
blobfoxboop
'
:
(
202
,
34
,
96
),
'
blobfoxboophappy
'
:
(
255
,
215
,
0
),
'
blobfoxcomfy
'
:
(
255
,
0
,
255
),
'
blobfoxcomfyhappy
'
:
(
255
,
0
,
255
),
'
blobfoxgoogly
'
:
(
255
,
0
,
127
),
# cool
'
blobfoxcool
'
:
(
0
,
0
,
255
),
'
blobfoxdealwithit
'
:
(
255
,
200
,
220
),
'
blobfoxninja
'
:
(
255
,
215
,
0
),
'
blobfoxnerd
'
:
(
255
,
0
,
255
),
'
blobfoxdab
'
:
(
255
,
0
,
127
),
'
blobfoxpirate
'
:
(
255
,
0
,
255
),
# sad
'
blobfoxsad
'
:
(
0
,
0
,
255
),
'
blobfoxterrified
'
:
(
255
,
215
,
0
),
'
blobfoxcryreach
'
:
(
202
,
34
,
96
),
'
blobfoxcry
'
:
(
255
,
0
,
255
),
'
blobfoxmeltsob
'
:
(
255
,
0
,
127
),
# love
'
blobfoxfloof
'
:
(
255
,
0
,
255
),
'
blobfoxfloof_w_
'
:
(
240
,
40
,
0
),
'
blobfoxfloofhappy
'
:
(
240
,
0
,
40
),
'
blobfoxfloofcute
'
:
(
255
,
0
,
0
),
'
blobfoxfloofdevil
'
:
(
140
,
0
,
20
),
'
blobfoxfloofreach
'
:
(
255
,
100
,
100
),
}
# switch off all leds
def
leds_off
():
for
i
in
range
(
0
,
40
):
leds
.
set_rgb
(
i
,
0
,
0
,
0
)
def
leds_all_color
(
r
:
int
,
g
:
int
,
b
:
int
):
for
i
in
range
(
0
,
40
):
leds
.
set_rgb
(
i
,
r
,
g
,
b
)
# switch on the leds for the button
def
leds_petal_on
(
petal
:
int
,
r
:
int
,
g
:
int
,
b
:
int
):
for
i
in
button_leds
[
petal
]:
leds
.
set_rgb
(
i
,
r
,
g
,
b
)
class
App
(
Application
):
def
__init__
(
self
,
app_ctx
:
ApplicationContext
)
->
None
:
super
().
__init__
(
app_ctx
)
...
...
@@ -71,10 +177,10 @@ class App(Application):
self
.
current
=
0
self
.
last
=
0
self
.
emoji
_dir
=
os
.
path
.
join
(
app_ctx
.
bundle_path
,
'
assets/blobfoxes/
'
)
self
.
emoji
s
=
os
.
listdir
(
self
.
emoji
_dir
)
print
(
self
.
emoji
_dir
)
print
(
self
.
emoji
s
)
self
.
blobfox
_dir
=
os
.
path
.
join
(
app_ctx
.
bundle_path
,
'
assets/blobfoxes/
'
)
self
.
blobfoxe
s
=
os
.
listdir
(
self
.
blobfox
_dir
)
print
(
self
.
blobfox
_dir
)
print
(
self
.
blobfoxe
s
)
self
.
emoji
=
'
blobfox
'
...
...
@@ -83,9 +189,9 @@ class App(Application):
def
draw
(
self
,
ctx
:
Context
)
->
None
:
# Paint the background black
ctx
.
rgb
(
0
,
0
,
0
).
rectangle
(
-
144
,
-
144
,
288
,
288
).
fill
()
emoji_filename
=
next
((
x
for
x
in
self
.
emoji
s
if
x
.
startswith
(
self
.
emoji
)))
emoji_filename
=
next
((
x
for
x
in
self
.
blobfoxe
s
if
x
.
startswith
(
self
.
emoji
)))
if
emoji_filename
:
ctx
.
image
(
os
.
path
.
join
(
self
.
emoji
_dir
,
emoji_filename
),
-
80
,
-
80
,
160
,
160
)
ctx
.
image
(
os
.
path
.
join
(
self
.
blobfox
_dir
,
emoji_filename
),
-
80
,
-
80
,
160
,
160
)
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
...
...
@@ -99,24 +205,24 @@ class App(Application):
self
.
i
-=
1
if
self
.
i
<
0
:
self
.
i
=
len
(
self
.
emoji
s
)
-
1
self
.
i
=
len
(
self
.
blobfoxe
s
)
-
1
self
.
emoji
=
self
.
emoji
s
[
self
.
i
]
self
.
emoji
=
self
.
blobfoxe
s
[
self
.
i
]
elif
direction
==
ins
.
buttons
.
PRESSED_RIGHT
:
if
(
self
.
current
-
self
.
last
)
>
100
:
self
.
last
=
self
.
current
self
.
i
+=
1
if
self
.
i
>=
len
(
self
.
emoji
s
):
if
self
.
i
>=
len
(
self
.
blobfoxe
s
):
self
.
i
=
0
self
.
emoji
=
self
.
emoji
s
[
self
.
i
]
self
.
emoji
=
self
.
blobfoxe
s
[
self
.
i
]
#
if self.emoji in emoji_colors:
#
leds_all_color(*emoji_colors[self.emoji])
#
else:
#
leds_off()
if
self
.
emoji
in
emoji_colors
:
leds_all_color
(
*
emoji_colors
[
self
.
emoji
])
else
:
leds_off
()
for
i
in
range
(
0
,
10
):
petal
=
ins
.
captouch
.
petals
[
i
]
...
...
@@ -125,13 +231,13 @@ class App(Application):
self
.
top_menu_selection
=
int
(
i
/
2
)
# print('top menu',self.top_menu_selection)
self
.
emoji
=
top_menu_emojis
[
self
.
top_menu_selection
]
#
leds_petal_on(i,255,0,0)
leds_petal_on
(
i
,
255
,
0
,
0
)
else
:
self
.
sub_menu_selection
=
int
(
i
/
2
)
# print('sub menu',self.sub_menu_selection)
self
.
emoji
=
sub_menu_emojis
[
self
.
top_menu_selection
][
self
.
sub_menu_selection
]
#
leds_petal_on(i,0,0,255)
#
leds.update()
leds_petal_on
(
i
,
0
,
0
,
255
)
leds
.
update
()
if
__name__
==
'
__main__
'
:
# Continue to make runnable via mpremote run.
...
...
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