Quick Question, @Andrew_Tuline (since this is your original code) what would be the best way to slow this WAYYYY down? This is the code for the accent lighting in my PC I built and it’s just annoyingly fast as it is. I don’t just want to increase the delay, because that would make it look “choppy”.
/* three_sin demo
By: Andrew Tuline
Date: Oct, 2014
3 sine waves, one for each colour. I’m already doing a lot with 2 sine waves, so I didn’t take this far.
FastLED 2.1 is available at https://github.com/FastLED/FastLED/tree/FastLED2.1
Note: If you receive compile errors (as I have in the Stino add-on for Sublime Text), set the compiler to ‘Full Compilation’.
*/
#include “FastLED.h” // FastLED library. Preferably the latest copy of FastLED 2.1.
// Fixed definitions cannot change on the fly.
#define COLOR_ORDER GRB // Are they RGB, GRB or what??
#define LED_TYPE WS2812B // What kind of strip are you using?
#define NUM_LEDS 18 // Number of LED’s
// Initialize changeable global variables.
uint8_t max_bright = 255; // Overall brightness definition. It can be changed on the fly.
struct CRGB leds[NUM_LEDS]; // Initialize our LED array.
// Initialize global variables for sequences
uint8_t thisdelay = 8; // A delay value for the sequence(s)
int wave1=0;
int wave2=0;
int wave3=0;
uint8_t inc1 = 2;
uint8_t inc2 = 1;
uint8_t inc3 = -3;
uint8_t lvl1 = 80;
uint8_t lvl2 = 80;
uint8_t lvl3 = 80;
uint8_t mul1 = 5;
uint8_t mul2 = 8;
uint8_t mul3 = 7;
void setup() {
Serial.begin(57600);
LEDS.addLeds<LED_TYPE, 12, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(max_bright);
set_max_power_in_volts_and_milliamps(5, 500); // FastLED 2.1 Power management set at 5V, 500mA
random16_set_seed(4832); // Awesome randomizer (which we don’t yet need here.)
random16_add_entropy(analogRead(2));
} // setup()
void loop () {
three_sin(); // Improved method of using non-blocking delay
show_at_max_brightness_for_power(); // Power managed display of LED’s
delay_at_max_brightness_for_power(thisdelay*2.5);
LEDS.countFPS();
} // loop()
void three_sin() {
wave1 += inc1;
wave2 += inc2;
wave3 += inc3;
for (int k=0; k<NUM_LEDS; k++) {
leds[k].r = qsub8(sin8(mul1k + wave1), lvl1); // Another fixed frequency, variable phase sine wave with lowered level
leds[k].g = qsub8(sin8(mul2k + wave2), lvl2); // A fixed frequency, variable phase sine wave with lowered level
leds[k].b = qsub8(sin8(mul3*k + wave3), lvl3); // A fixed frequency, variable phase sine wave with lowered level
}
} // three_sin()