Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
?
lecture-code
Commits
16660280
Commit
16660280
authored
4 months ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
autocommit
parent
643fec5b
master
rkalahas-master-patch-39159
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
07/interact.py
+23
-1
07/interact.py
with
23 additions
and
1 deletion
+23
-1
07/interact.py
View file @
16660280
...
...
@@ -8,6 +8,28 @@ GREEN: tuple[int, int, int] = (0, 255, 0)
YELLOW
:
tuple
[
int
,
int
,
int
]
=
(
255
,
255
,
0
)
def
change_color
(
color
:
tuple
[
int
,
int
,
int
])
->
tuple
[
int
,
int
,
int
]:
if
color
==
RED
:
color
=
GREEN
elif
color
==
YELLOW
:
color
=
RED
else
:
color
=
YELLOW
return
color
def
run
(
apds
:
ProximitySensor
,
pixels
:
LEDController
,
touch
:
TouchSensor
):
color
:
tuple
[
int
,
int
,
int
]
=
RED
while
True
:
pixels
.
fill
(
YELLOW
)
print
(
"d"
)
prox
=
apds
.
proximity
if
prox
>=
10
or
color
==
GREEN
:
color
=
change_color
(
color
)
else
:
color
=
RED
pixels
.
fill
(
color
)
time
.
sleep
(
1
)
if
touch
.
value
:
print
(
"hi!!!"
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help