While (angle < 2 * PI) { a = radius*cos(angle); b = radius*sin(angle);

while (angle < 2 * PI)
    a = radius*cos(angle);
    b = radius*sin(angle);
    i = (a+radius-1)+width*(b+radius-1);
    leds[i] += CHSV (0, 255, 255);
    angle += angle_stepsize;


this will produce a circle on an led matrix…

why won’t the same code, with the replacement of sin8 or sin16 produce the same results? is there a tweak to my code that will allow it to work?

Doesn’t the Arduino trig function want the angle in radians, while the FastLED function input is 0-255?

Marc is right, Arduino standard trig functions want an angle in radians ( floating number ) as input and has an output between -1 and 1 ( also a floating number, actually a double precision float )

The usefulness of the FastLED sin8 and sin16 functions is that they use integers as input AND provide an integer output. That is much faster and surprisingly accurate.

I knew it would be easy to fix! Thanks

@Jason_Coon - is there any reason why my previous comment here does not show up publicly?

@Ken_White I actually saw your post here when you first put it up and then it disappeared. (I have no idea why though.)