Sooooo... this is question is probably borderline insulting,

Sooooo… this is question is probably borderline insulting, but I am trying to make a simple pulsating light, pretty simple thing but for the life of me I cant figure out how to “slow down” a quadwave8 function to drive the setBrightness function. In a normal sine wave I would just divide x by whatever value I want so it decreases the frequency of the wave. But if I try that using de quadwave8, it just makes a weird Jigsaw style wave.

does anybody have a suggestion on how I can do this? I have tried everything I can think of with no good result.

this is the code I have for that section:

if(fadeUp == false) {
counta += 1;

brightness = min_bright+quadwave8(counta)/2;
}

Thanks for any kind of suggestions :slight_smile:

You might take a look at beatsin8, you can control how many times per minute it cycles. I’ve made a beatcos8 companion method, you should be able to look at the source and make a ‘beatquad8’ one: https://github.com/pixelmatix/aurora/blob/Aurora1.5/Effects.h

This will cycle from 0 to 255 and back once per minute:

brightness = beatsin8(1, 0, 255);

I came up with this.

Add to your variables:
uint16_t count;
uint8_t speed = 15; // Higher number gives slower pulse

And in main loop:

uint8_t value = quadwave8(count/speed);
//Serial.print(" count: “); Serial.print(count);
//Serial.print(” value: "); Serial.println(value);
for (int i=0; i<NUM_LEDS; i++) {
leds[i] = CHSV(80,255,value);
}
FastLED.show();

count++;
if (value >= 255){
count = 0;
}

wohoo!!! the beatsin8 function worked like a charm and exactly what I needed, thanks Jason! I didnt get to try your option Marc since the beatsin8 makes for a one line piece of code that does what I nedded, thank you very much though, it is really apreciated.

Now Jason… where can I find all this extra functions that I have seen in other peoples pieces of code, like beatsin8, since it doesnt appear to be documented, or at least I couldnt find it :s I have seen others like :
set_max_power_in_volts_and_milliamps(5, 500);
delay_at_max_brightness_for_power();

these are from the Demo pack that Andrew Tuline put together (awsome set of examples by the way) but I cant find those functions anywhere.

https://github.com/FastLED/FastLED/blob/master/lib8tion.h
Line 143.

https://github.com/FastLED/FastLED/blob/master/power_mgt.cpp
for the power stuff.

Glad to help. :slight_smile: I’d read through the wiki if you haven’t: https://github.com/FastLED/FastLED/wiki/Overview

And the API reference: http://fastled.io/docs/3.1/

Or just look through the code, like Marc linked to.

Thank you very much guys, I did find the references, I had read through the wiki a whole bunch of times but I guess I wasnt really sure I understood what I was looking at… My programming experiences is not exactly where I would like it to be or fully at par with my ideas but thanks for the help, it is very useful! :slight_smile: