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
3cdbce39
Commit
3cdbce39
authored
2 years ago
by
ef1g21
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
ca9db8e0
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
chooseAColourSkeleton.py
+37
-0
37 additions, 0 deletions
chooseAColourSkeleton.py
with
37 additions
and
0 deletions
chooseAColourSkeleton.py
0 → 100644
+
37
−
0
View file @
3cdbce39
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
)
#TODO: Add some predefined colours
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:
"
)
#TODO: Sanitise user input to remove spaces
if
user
==
"
blue
"
:
#TODO: Switch on the LED to that particular colour
#TODO: Do the same for all the rest of your colours
elif
user
==
"
off
"
:
led
.
set_pixel
(
0
,
(
0
,
0
,
0
))
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