Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Pick a colour
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ef1g21
Pick a colour
Commits
29b90b05
Commit
29b90b05
authored
2 years ago
by
ef1g21
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
27329d3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
chooseAColour.py
+56
-0
56 additions, 0 deletions
chooseAColour.py
with
56 additions
and
0 deletions
chooseAColour.py
0 → 100644
+
56
−
0
View file @
29b90b05
from
neopixel
import
Neopixel
import
utime
led
=
Neopixel
(
1
,
0
,
28
,
"
RGB
"
)
# 1 LED, state machine 0, GP28 pin, RGB colour mode
blue
=
(
195
,
0
,
90
)
red
=
(
0
,
255
,
0
)
green
=
(
255
,
50
,
0
)
yellow
=
(
255
,
255
,
0
)
pink
=
(
105
,
255
,
104
)
while
True
:
print
(
"
To switch off the LED enter
'
off
'"
)
print
(
"
Predefined colours are blue,red,green,yellow and pink
"
)
user
=
input
(
"
Enter the colour if you want from predefined colours:
"
)
user_input
=
user
.
strip
()
print
(
"
You entered:
"
,
user_input
)
if
user_input
==
"
blue
"
:
led
.
set_pixel
(
0
,
blue
)
led
.
show
()
elif
user_input
==
"
green
"
:
led
.
set_pixel
(
0
,
green
)
led
.
show
()
elif
user_input
==
"
red
"
:
led
.
set_pixel
(
0
,
red
)
led
.
show
()
elif
user_input
==
"
yellow
"
:
led
.
set_pixel
(
0
,
yellow
)
led
.
show
()
elif
user_input
==
"
off
"
:
led
.
set_pixel
(
0
,
(
0
,
0
,
0
))
led
.
show
()
elif
user_input
==
"
pink
"
:
led
.
set_pixel
(
0
,
pink
)
led
.
show
()
\ 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