Skip to content

num of LEDs needs to be modulo 3 #1

@antonmeyer

Description

@antonmeyer

there is a bug in:
for (int q=0; q < 3; q++) {
for (int i=0; i < NUM_LEDS; i=i+3) {
int pos = i+q;
leds[pos] = c;
if NUM_LEDS is 50 you end up in 48 + 2 = 50 for i = 48 q = 2
which writes to an position outside the array or cause an exception
you better check for (i+q) < NUM_LEDS

this limitation / bug is inherried from examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions