Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
246 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef besin_H | ||
#define besin_H | ||
|
||
void besin() { // Add a Perlin noise soundbar. This looks really cool. | ||
|
||
// Local definitions | ||
|
||
|
||
// Persistent local variables | ||
|
||
|
||
timeval = 30; // Our EVERY_N_MILLIS_I timer value. | ||
|
||
|
||
// This works. | ||
leds[NUM_LEDS/2] = ColorFromPalette(currentPalette, millis(), sampleavg, NOBLEND); | ||
leds[NUM_LEDS/2-1] = ColorFromPalette(currentPalette, millis(), sampleavg, NOBLEND); | ||
|
||
|
||
// leds[NUM_LEDS/2] = ColorFromPalette(currentPalette, sampleavg, beatsin8(sampleavg,0,255), NOBLEND); | ||
// leds[NUM_LEDS/2-1] = ColorFromPalette(currentPalette, sampleavg, beatsin8(sampleavg,0,255), NOBLEND); | ||
|
||
|
||
waveit(); // Move the pixels to the left/right, but not too fast. | ||
|
||
// fadeToBlackBy(leds+NUM_LEDS/2-1, 2, 128); // Fade the center, while waveit moves everything out to the edges. | ||
fadeToBlackBy(leds, NUM_LEDS, 2); | ||
|
||
} // besin() | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef NOISEFIRETEST_H | ||
#define NOISEFIRETEST_H | ||
|
||
void noisefiretest() { // Create fire based on noise and sampleavg. | ||
|
||
// Local definitions | ||
#define xscale 20 // How far apart they are | ||
#define yscale 3 // How fast they move | ||
|
||
// Temporary local variable | ||
uint16_t index = 0; // Current colour lookup value. | ||
|
||
timeval = 10; // Our EVERY_N_MILLIS_I timer value. | ||
|
||
currentPalette = CRGBPalette16(CHSV(0,255,2), CHSV(0,255,4), CHSV(0,255,8), CHSV(0, 255, 8), // Fire palette definition. Lower value = darker. | ||
CHSV(0, 255, 16), CRGB::Red, CRGB::Red, CRGB::Red, | ||
CRGB::DarkOrange,CRGB::DarkOrange, CRGB::Orange, CRGB::Orange, | ||
CRGB::Yellow, CRGB::Orange, CRGB::Yellow, CRGB::Yellow); | ||
|
||
for(int i = 0; i < NUM_LEDS; i++) { | ||
|
||
// Serial.print(i); | ||
// Serial.print(" "); | ||
index = inoise8(i*xscale,millis()*yscale*NUM_LEDS/255); // X location is constant, but we move along the Y at the rate of millis(). By Andrew Tuline. | ||
// Serial.print(index); | ||
// Serial.print(" "); | ||
|
||
// index = (255 - *i*128/NUM_LEDS); // Now we need to scale index so that it gets blacker as we get close to one of the ends | ||
|
||
index = (255 - i*256/NUM_LEDS) * index / 128; // Now we need to scale index so that it gets blacker as we get close to one of the ends | ||
|
||
|
||
// Serial.print(index); | ||
// Serial.println(" "); | ||
|
||
|
||
leds[NUM_LEDS/2-i/2+1] = ColorFromPalette(currentPalette, index, sampleavg, NOBLEND); // With that value, look up the 8 bit colour palette value and assign it to the current LED. | ||
leds[NUM_LEDS/2+i/2-1] = ColorFromPalette(currentPalette, index, sampleavg, NOBLEND); // With that value, look up the 8 bit colour palette value and assign it to the current LED. | ||
|
||
} // The higher the value of i => the higher up the palette index (see palette definition). | ||
|
||
|
||
} // noisefiretest() | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef NOISEPAL_H | ||
#define NOISEPAL_H | ||
|
||
void noisepal() { // Create fire based on noise and sampleavg. | ||
|
||
// Local definitions | ||
#define xscale 20 // How far apart they are | ||
#define yscale 3 // How fast they move | ||
|
||
// Temporary local variable | ||
uint16_t index = 0; // Current colour lookup value. | ||
|
||
timeval = 10; // Our EVERY_N_MILLIS_I timer value. | ||
|
||
/* currentPalette = CRGBPalette16(CHSV(0,255,2), CHSV(0,255,4), CHSV(0,255,8), CHSV(0, 255, 8), // Fire palette definition. Lower value = darker. | ||
CHSV(0, 255, 16), CRGB::Red, CRGB::Red, CRGB::Red, | ||
CRGB::DarkOrange,CRGB::DarkOrange, CRGB::Orange, CRGB::Orange, | ||
CRGB::Yellow, CRGB::Orange, CRGB::Yellow, CRGB::Yellow); | ||
*/ | ||
|
||
|
||
for(int i = 0; i < NUM_LEDS; i++) { | ||
|
||
// Serial.print(i); | ||
// Serial.print(" "); | ||
index = inoise8(i*xscale,millis()*yscale*NUM_LEDS/255); // X location is constant, but we move along the Y at the rate of millis(). By Andrew Tuline. | ||
// Serial.print(index); | ||
// Serial.print(" "); | ||
|
||
// index = (255 - *i*128/NUM_LEDS); // Now we need to scale index so that it gets blacker as we get close to one of the ends | ||
|
||
index = (255 - i*256/NUM_LEDS) * index / 128; // Now we need to scale index so that it gets blacker as we get close to one of the ends | ||
|
||
|
||
// Serial.print(index); | ||
// Serial.println(" "); | ||
|
||
|
||
leds[NUM_LEDS/2-i/2+1] = ColorFromPalette(currentPalette, index, sampleavg, NOBLEND); // With that value, look up the 8 bit colour palette value and assign it to the current LED. | ||
leds[NUM_LEDS/2+i/2-1] = ColorFromPalette(currentPalette, index, sampleavg, NOBLEND); // With that value, look up the 8 bit colour palette value and assign it to the current LED. | ||
|
||
} // The higher the value of i => the higher up the palette index (see palette definition). | ||
|
||
|
||
} // noisepalt() | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef NOISEWIDE_H | ||
#define NOISEWIDE_H | ||
|
||
void noisewide() { | ||
|
||
timeval = 10; // Our EVERY_N_MILLIS_I timer value. | ||
|
||
uint8_t tempsamp = constrain(sampleavg/2,0,NUM_LEDS/2); | ||
|
||
memset(leds, 0, NUM_LEDS * 3); // Quick clearing of the LED's. | ||
|
||
for (int i=0; i<tempsamp; i++) { | ||
|
||
uint8_t index = inoise8(i*sampleavg+millis(), 5000+i*sampleavg); | ||
// index = inoise8(i*20,millis()*3*NUM_LEDS/255); | ||
|
||
leds[NUM_LEDS/2-i] = ColorFromPalette(currentPalette, index, sampleavg, currentBlending); | ||
leds[NUM_LEDS/2+i] = ColorFromPalette(currentPalette, index, sampleavg, currentBlending); | ||
|
||
} | ||
|
||
} // noisewide() | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef PIXELS_H | ||
#define PIXELS_H | ||
|
||
void pixels() { | ||
|
||
// Persistent local variable | ||
static uint16_t currLED; // Persistent local value to count the current LED location. | ||
|
||
timeval = 50; // Our EVERY_N_MILLIS_I timer value. | ||
|
||
currLED = beatsin8(16,0,10); | ||
|
||
for (int i=0; i<NUM_LEDS; i++) { | ||
|
||
CRGB newcolour = ColorFromPalette(currentPalette, oldsample+i*8, sampleavg, currentBlending); // Colour of the LED will be based on oldsample, while brightness is based on sampleavg. | ||
nblend(leds[(i+currLED)%NUM_LEDS], newcolour, 192); // Blend the old value and the new value for a gradual transitioning. | ||
|
||
} | ||
|
||
} // pixels() | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.