Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Fade
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ajk1e20
Fade
Commits
9bb3fdef
Commit
9bb3fdef
authored
3 years ago
by
ajk1e20
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parents
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fade.cpp
+81
-0
81 additions, 0 deletions
fade.cpp
with
81 additions
and
0 deletions
fade.cpp
0 → 100644
+
81
−
0
View file @
9bb3fdef
#include
<stdio.h>
#include
"pico/stdlib.h"
#include
"hardware/gpio.h"
#include
"pico/binary_info.h"
#include
"WS2812.hpp"
const
uint
BUTTON_SPEED_UP
=
20
;
const
uint
BUTTON_SLOW_DOWN
=
21
;
const
uint
ON_OFF_BUTTON
=
22
;
const
uint
RGB
=
28
;
uint
counter
=
50
;
int
main
()
{
stdio_init_all
();
//Initialize the LED Strip using ledStrip in WS2812 in Git
WS2812
ledStrip
(
RGB
,
1
,
pio0
,
0
);
//Add button to slow down
while
(
!
gpio_get
(
BUTTON_SLOW_DOWN
))
{
counter
=
counter
+
50
;
}
//add button to speed up
while
(
!
gpio_get
(
BUTTON_SPEED_UP
))
{
if
(
counter
>
50
)
{
counter
=
counter
-
50
;
}
}
while
(
!
gpio_get
(
ON_OFF_BUTTON
))
{
//Add colours you wish to display in your
//Set all LEDs to Red
ledStrip
.
fill
(
WS2812
::
RGB
(
255
,
0
,
0
));
ledStrip
.
show
();
sleep_ms
(
counter
);
for
(
i
=
0
;
i
<
255
<
i
++
)
{
//Set all Leds to Green
ledStrip
.
fill
(
WS2812
::
RGB
(
255
-
i
,
i
,
0
));
ledStrip
.
show
();
sleep_ms
(
counter
);
}
for
(
i
=
0
;
i
<
255
<
i
++
)
{
//Set all LEDs to Cyan
ledStrip
.
fill
(
WS2812
::
RGB
(
0
,
255
,
i
));
ledStrip
.
show
();
sleep_ms
(
counter
);
}
for
(
i
=
0
;
i
<
255
<
i
++
)
{
//Set all LEDs to Blue
ledStrip
.
fill
(
WS2812
::
RGB
(
0
,
255
-
i
,
255
));
ledStrip
.
show
();
sleep_ms
(
counter
);
}
for
(
i
=
0
;
i
<
255
<
i
++
)
{
//Set all LEDs to Pink
ledStrip
.
fill
(
WS2812
::
RGB
(
i
,
0
,
255
));
ledStrip
.
show
();
sleep_ms
(
counter
);
}
for
(
i
=
0
;
i
<
255
<
i
++
)
{
//Set all LEDs to Yellow
ledStrip
.
fill
(
WS2812
::
RGB
(
255
,
0
,
255
-
i
));
ledStrip
.
show
();
sleep_ms
(
counter
);
}
}
}
\ 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