Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ambilight_Computer_Embedded
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Frederic Aust
Ambilight_Computer_Embedded
Commits
43578872
Commit
43578872
authored
5 years ago
by
Frederic Aust
Browse files
Options
Downloads
Patches
Plain Diff
Grundeinstellungen getätigt und die Initialhelligkeit auf 100 gesetzt
parent
46dd3e88
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
Adalight_WS2812/Adalight_WS2812.ino
+83
-0
83 additions, 0 deletions
Adalight_WS2812/Adalight_WS2812.ino
with
83 additions
and
0 deletions
Adalight_WS2812/Adalight_WS2812.ino
0 → 100644
+
83
−
0
View file @
43578872
/*
* Arduino interface for the use of WS2812 strip LEDs
* Uses Adalight protocol and is compatible with Boblight, Prismatik etc...
* "Magic Word" for synchronisation is 'Ada' followed by LED High, Low and Checksum
* Fork von Wifsimster <wifsimster@gmail.com>
*/
#include
"FastLED.h"
// Number of LEDs
#define NUM_LEDS 112
#define DATA_PIN 3
// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
#define serialRate 115200
// Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
uint8_t
prefix
[]
=
{
'A'
,
'd'
,
'a'
},
hi
,
lo
,
chk
,
i
;
// Initialise LED-array
CRGB
leds
[
NUM_LEDS
];
void
setup
()
{
// Use NEOPIXEL to keep true colors
FastLED
.
addLeds
<
NEOPIXEL
,
DATA_PIN
>
(
leds
,
NUM_LEDS
);
LEDS
.
setBrightness
(
100
);
// Initial RGB flash
LEDS
.
showColor
(
CRGB
(
255
,
0
,
0
));
delay
(
500
);
LEDS
.
showColor
(
CRGB
(
0
,
255
,
0
));
delay
(
500
);
LEDS
.
showColor
(
CRGB
(
0
,
0
,
255
));
delay
(
500
);
LEDS
.
showColor
(
CRGB
(
0
,
0
,
0
));
Serial
.
begin
(
serialRate
);
// Send "Magic Word" string to host
Serial
.
print
(
"Ada
\n
"
);
}
void
loop
()
{
// Wait for first byte of Magic Word
for
(
i
=
0
;
i
<
sizeof
prefix
;
++
i
)
{
waitLoop:
while
(
!
Serial
.
available
())
;;
// Check next byte in Magic Word
if
(
prefix
[
i
]
==
Serial
.
read
())
continue
;
// otherwise, start over
i
=
0
;
goto
waitLoop
;
0
}
// Hi, Lo, Checksum
while
(
!
Serial
.
available
())
;;
hi
=
Serial
.
read
();
while
(
!
Serial
.
available
())
;;
lo
=
Serial
.
read
();
while
(
!
Serial
.
available
())
;;
chk
=
Serial
.
read
();
// If checksum does not match go back to wait
if
(
chk
!=
(
hi
^
lo
^
0x55
))
{
i
=
0
;
goto
waitLoop
;
}
memset
(
leds
,
0
,
NUM_LEDS
*
sizeof
(
struct
CRGB
));
// Read the transmission data and set LED values
for
(
uint8_t
i
=
0
;
i
<
NUM_LEDS
;
i
++
)
{
byte
r
,
g
,
b
;
while
(
!
Serial
.
available
());
r
=
Serial
.
read
();
while
(
!
Serial
.
available
());
g
=
Serial
.
read
();
while
(
!
Serial
.
available
());
b
=
Serial
.
read
();
leds
[
i
].
r
=
r
;
leds
[
i
].
g
=
g
;
leds
[
i
].
b
=
b
;
}
// Shows new values
FastLED
.
show
();
}
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