diff options
author | Marc Miller <marmilicious@users.noreply.github.com> | 2021-04-04 05:31:24 +0300 |
---|---|---|
committer | Marc Miller <marmilicious@users.noreply.github.com> | 2021-04-04 05:31:24 +0300 |
commit | f57fca35cec6f1b3552ad8e12e0c491a92ea58e0 (patch) | |
tree | d8578925348758de1a9879c6ced803413a705927 /examples/Noise/Noise.ino | |
parent | b5874b588ade1d2639925e4e9719fa7d3c9d9e94 (diff) |
Some Modernization updates for #1208
As suggested in #1208 this updates:
LEDS.[function] to FastLED.[function]
Switch from byte to uint8_t
Use uint16_t for all LED index variables
Remove messages about minimum version
Diffstat (limited to 'examples/Noise/Noise.ino')
-rw-r--r-- | examples/Noise/Noise.ino | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/Noise/Noise.ino b/examples/Noise/Noise.ino index b0635702..9b72aaa8 100644 --- a/examples/Noise/Noise.ino +++ b/examples/Noise/Noise.ino @@ -5,15 +5,15 @@ // // Params for width and height -const uint8_t kMatrixWidth = 16; -const uint8_t kMatrixHeight = 16; +const uint16_t kMatrixWidth = 16; +const uint16_t kMatrixHeight = 16; #define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight) #define NUM_LEDS (kMatrixWidth * kMatrixHeight) // Param for different pixel layouts const bool kMatrixSerpentineLayout = true; -uint16_t XY( uint8_t x, uint8_t y) +uint16_t XY( uint16_t x, uint16_t y) { uint16_t i; @@ -24,7 +24,7 @@ uint16_t XY( uint8_t x, uint8_t y) if( kMatrixSerpentineLayout == true) { if( y & 0x01) { // Odd rows run backwards - uint8_t reverseX = (kMatrixWidth - 1) - x; + uint16_t reverseX = (kMatrixWidth - 1) - x; i = (y * kMatrixWidth) + reverseX; } else { // Even rows run forwards @@ -62,15 +62,15 @@ uint16_t speed = 20; // a nice starting speed, mixes well with a scale of 100 uint16_t scale = 311; // This is the array that we keep our computed noise values in -uint8_t noise[MAX_DIMENSION][MAX_DIMENSION]; +uint16_t noise[MAX_DIMENSION][MAX_DIMENSION]; void setup() { // uncomment the following lines if you want to see FPS count information // Serial.begin(38400); // Serial.println("resetting!"); delay(3000); - LEDS.addLeds<WS2811,2,RGB>(leds,NUM_LEDS); - LEDS.setBrightness(96); + FastLED.addLeds<WS2811,2,RGB>(leds,NUM_LEDS); + FastLED.setBrightness(96); // Initialize our coordinates to some random values x = random16(); @@ -107,6 +107,6 @@ void loop() { } ihue+=1; - LEDS.show(); + FastLED.show(); // delay(10); } |