MCPcopy Create free account
hub / github.com/FastLED/FastLED / xy

Function xy

examples/Ports/PJRCSpectrumAnalyzer/PJRCSpectrumAnalyzer.h:86–94  ·  view source on GitHub ↗

A simple xy() function to turn display matrix coordinates into the index numbers OctoWS2811 requires. If your LEDs are arranged differently, edit this code...

Source from the content-addressed store, hash-verified

84// into the index numbers OctoWS2811 requires. If your LEDs
85// are arranged differently, edit this code...
86unsigned int xy(unsigned int x, unsigned int y) {
87 if ((y & 1) == 0) {
88 // even numbered rows (0, 2, 4...) are left to right
89 return y * matrix_width + x;
90 } else {
91 // odd numbered rows (1, 3, 5...) are right to left
92 return y * matrix_width + matrix_width - 1 - x;
93 }
94}
95
96// Run repetitively
97void loop() {

Callers 1

loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected