Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define NUM_LEDS = 150;
- int HALF_POS = NUM_LEDS*0.5;
- void radiate() {
- // this is for msgeq7 smoothing. every 10 milliseconds, data is read. not necessary.
- // but it smooths out the data a bit.
- //MILLISECONDS = 10;
- //lowPass_audio = 0.17;
- //filter_min = 150;
- // above is a low-pass data filter and data floor. I use these to smooth msgeq7 data in the following math located in my readAudio function:
- //prev_value = left[band];
- //prev_value -= (prev_value * EQ[band]);
- //left_value = analogRead(AUDIO_LEFT_PIN);
- //left_value = constrain(left_value, filter_min, filter_max);
- //left_value = map(left_value, filter_min, filter_max, value_floor, filter_max );
- //left[band] = prev_value + (left_value - prev_value) * lowPass_audio;
- // following code is not entirely necessary. just here to further filter the audio data
- zero = mono[0] * 0.25;
- // if (zero < 40) {
- // zero -= (zero * 0.10);
- // }
- three = mono[3] * 0.23;
- if (three < 80) {
- three -= (three * 0.25);
- }
- six = mono[6] * 0.25;
- if (six < 40) {
- six -= (six * 0.10);
- }
- leds[HALF_POS] = CRGB(zero, three, six);
- EVERY_N_MILLISECONDS(10) {
- for (int i = NUM_LEDS; i > HALF_POS; i--) {
- leds[i].blue = leds[i - 1].blue;
- }
- }
- EVERY_N_MILLISECONDS(20) {
- for (int i = NUM_LEDS; i > HALF_POS; i--) {
- leds[i].green = leds[i - 1].green;
- }
- }
- EVERY_N_MILLISECONDS(50) {
- for (int i = NUM_LEDS; i > HALF_POS; i--) {
- leds[i].red = leds[i - 1].red;
- }
- }
- for (int i = NUM_LEDS; i > HALF_POS; i--) {
- leds[HALF_POS - (i - HALF_POS)] = leds[i - 1];
- }
- //blur1d(leds, NUM_LEDS, 5); //blurring the led array a small amount makes for a pretty interesting effect
- FastLED.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment