FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

◆ Circle()

ScreenMap fl::ScreenMap::Circle ( int numLeds,
float cm_between_leds = 1.5f,
float cm_led_diameter = 0.5f )
static

Definition at line 21 of file screenmap.cpp.

22 {
23 ScreenMap screenMap = ScreenMap(numLeds);
24 float circumference = numLeds * cm_between_leds;
25 float radius = circumference / (2 * PI);
26
27 for (int i = 0; i < numLeds; i++) {
28 float angle = i * 2 * PI / numLeds;
29 float x = radius * cos(angle) * 2;
30 float y = radius * sin(angle) * 2;
31 screenMap[i] = {x, y};
32 }
33 screenMap.setDiameter(cm_led_diameter);
34 return screenMap;
35}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
ScreenMap screenMap
Definition FxSdCard.ino:60
ScreenMap()=default
#define PI
Definition math_macros.h:20

References ScreenMap(), PI, screenMap, x, and y.

Referenced by setup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: