diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2014-06-04 09:09:31 +0400 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2014-06-04 09:09:31 +0400 |
commit | 244b23b70c70b53ae28a57fbdde579e8c2cd1a6f (patch) | |
tree | f032bc3e5174185422a5a21b2adcf0224c13fca1 /examples | |
parent | 87bb883680c09bff44bcf24fb3c33b430ac5ee89 (diff) |
Fixing noise on avr with the new raw noise functions
Diffstat (limited to 'examples')
-rw-r--r-- | examples/NoisePlayground/NoisePlayground.ino | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/examples/NoisePlayground/NoisePlayground.ino b/examples/NoisePlayground/NoisePlayground.ino index 4327adb9..f3cd7f9e 100644 --- a/examples/NoisePlayground/NoisePlayground.ino +++ b/examples/NoisePlayground/NoisePlayground.ino @@ -1,11 +1,11 @@ #include <FastLED.h> -#define kMatrixWidth 16 -#define kMatrixHeight 16 +#define kMatrixWidth 8 +#define kMatrixHeight 5 #define NUM_LEDS (kMatrixWidth * kMatrixHeight) // Param for different pixel layouts -#define kMatrixSerpentineLayout true +#define kMatrixSerpentineLayout false // led array CRGB leds[kMatrixWidth * kMatrixHeight]; @@ -17,29 +17,33 @@ uint32_t x,y,v_time,hue_time; // have! More octaves will make things slower. // how many octaves to use for the brightness and hue functions -uint8_t octaves=2; -uint8_t hue_octaves=2; +uint8_t octaves=3; +uint8_t hue_octaves=3; // the 'distance' between points on the x and y axis -int xscale=301; -int yscale=301; +int xscale=3311; +int yscale=3311; // the 'distance' between x/y points for the hue noise -int hue_scale=11; +int hue_scale=1; // how fast we move through time & hue noise -int time_speed=101; -int hue_speed=3; +int time_speed=5101; +int hue_speed=1; // adjust these values to move along the x or y axis between frames int x_speed=0; -int y_speed=1; +int y_speed=0; 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); + LEDS.show(); LEDS.countFPS(); @@ -48,6 +52,7 @@ void loop() { y += y_speed; v_time += time_speed; hue_time += hue_speed; + // delay(50); } @@ -63,9 +68,12 @@ 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 = (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(); } |