PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Simple Libraries
Light
libws2812
ws2812_wheel.c
Go to the documentation of this file.
1
14
#include "
ws2812.h
"
15
16
uint32_t
ws2812_wheel
(
int
pos)
17
{
18
uint32_t color;
19
20
// Creates color from 0 to 255 position input
21
// -- colors transition r-g-b back to r
22
23
// red range
24
if
(pos < 85)
25
color = COLOR(255-pos*3, pos*3, 0);
26
27
// green range
28
else
if
(pos < 170) {
29
pos -= 85;
30
color = COLOR(0, 255-pos*3, pos*3);
31
}
32
33
// blue range
34
else
{
35
pos -= 170;
36
color = COLOR(pos*3, 0, 255-pos*3);
37
}
38
39
return
color;
40
}
41
ws2812_wheel
uint32_t ws2812_wheel(int pos)
Create color from a 0 to 255 position input.
Definition:
ws2812_wheel.c:16
ws2812.h
Generated on Sat Aug 27 2016 00:58:09 for PropWare by
1.8.12