diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2014-06-05 21:45:10 +0400 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2014-06-05 21:45:10 +0400 |
commit | ac2210725ac239157933b81d91fcb8dc0c4ecfd1 (patch) | |
tree | e1ccc45097c04f6ad3cf6677a476773cbff5f9db /examples/NoisePlayground | |
parent | 7073454b0b881d46f95d747d000032af6eb7a034 (diff) |
For the fill_raw functions for all of 8bit, 16bit, and 16bit into 8 bit, shift the centerpoint of the noise function from 127/32767 to 0. For the fill_noise functions this will result in the colors centering on reds instead of blues
Diffstat (limited to 'examples/NoisePlayground')
-rw-r--r-- | examples/NoisePlayground/NoisePlayground.ino | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/examples/NoisePlayground/NoisePlayground.ino b/examples/NoisePlayground/NoisePlayground.ino index f3cd7f9e..35890146 100644 --- a/examples/NoisePlayground/NoisePlayground.ino +++ b/examples/NoisePlayground/NoisePlayground.ino @@ -1,48 +1,45 @@ #include <FastLED.h> -#define kMatrixWidth 8 -#define kMatrixHeight 5 +#define kMatrixWidth 16 +#define kMatrixHeight 16 #define NUM_LEDS (kMatrixWidth * kMatrixHeight) // Param for different pixel layouts -#define kMatrixSerpentineLayout false +#define kMatrixSerpentineLayout true // led array CRGB leds[kMatrixWidth * kMatrixHeight]; // x,y, & time values -uint32_t x,y,v_time,hue_time; +uint32_t x,y,v_time,hue_time,hxy; // Play with the values of the variables below and see what kinds of effects they // have! More octaves will make things slower. // how many octaves to use for the brightness and hue functions -uint8_t octaves=3; +uint8_t octaves=1; uint8_t hue_octaves=3; // the 'distance' between points on the x and y axis -int xscale=3311; -int yscale=3311; +int xscale=57771; +int yscale=57771; // the 'distance' between x/y points for the hue noise int hue_scale=1; // how fast we move through time & hue noise -int time_speed=5101; -int hue_speed=1; +int time_speed=1111; +int hue_speed=31; // adjust these values to move along the x or y axis between frames -int x_speed=0; -int y_speed=0; +int x_speed=331; +int y_speed=1111; void loop() { // fill the led array 2/16-bit noise values fill_2dnoise16(LEDS.leds(), kMatrixWidth, kMatrixHeight, kMatrixSerpentineLayout, octaves,x,xscale,y,yscale,v_time, - hue_octaves,x,hue_scale,y,hue_scale,hue_time, false); - static byte beacon = 0; - beacon++; - leds[0] = CHSV( beacon, 255, 255); + hue_octaves,hxy,hue_scale,hxy,hue_scale,hue_time, false); LEDS.show(); LEDS.countFPS(); @@ -58,7 +55,7 @@ void loop() { void setup() { // initialize the x/y and time values - random16_set_seed(18934); + random16_set_seed(8934); random16_add_entropy(analogRead(3)); Serial.begin(57600); @@ -68,12 +65,10 @@ void setup() { LEDS.addLeds<WS2811,6,GRB>(leds,NUM_LEDS); LEDS.setBrightness(96); - // x = (uint32_t)((uint32_t)random16() << 16) | random16(); - // y = (uint32_t)((uint32_t)random16() << 16) | random16(); - // v_time = (uint32_t)((uint32_t)random16() << 16) | random16(); - x = 1; - y = 1; - v_time = 1; - hue_time = (uint32_t)((uint32_t)random16() << 16) | random16(); + hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); + x = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); + y = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); + v_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); + hue_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); } |