diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Cylon/Cylon.ino | 6 | ||||
-rw-r--r-- | examples/DemoReel100/DemoReel100.ino | 5 | ||||
-rw-r--r-- | examples/Fire2012/Fire2012.ino | 2 | ||||
-rw-r--r-- | examples/Fire2012WithPalette/Fire2012WithPalette.ino | 4 | ||||
-rw-r--r-- | examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino | 12 | ||||
-rw-r--r-- | examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino | 12 | ||||
-rw-r--r-- | examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino | 8 | ||||
-rw-r--r-- | examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino | 14 | ||||
-rw-r--r-- | examples/Noise/Noise.ino | 10 | ||||
-rw-r--r-- | examples/NoisePlayground/NoisePlayground.ino | 14 | ||||
-rw-r--r-- | examples/NoisePlusPalette/NoisePlusPalette.ino | 9 | ||||
-rw-r--r-- | examples/RGBSetDemo/RGBSetDemo.ino | 2 | ||||
-rw-r--r-- | examples/SmartMatrix/SmartMatrix.ino | 6 | ||||
-rw-r--r-- | examples/TwinkleFox/TwinkleFox.ino | 4 | ||||
-rw-r--r-- | examples/XYMatrix/XYMatrix.ino | 13 |
15 files changed, 61 insertions, 60 deletions
diff --git a/examples/Cylon/Cylon.ino b/examples/Cylon/Cylon.ino index f51c3487..96d4949a 100644 --- a/examples/Cylon/Cylon.ino +++ b/examples/Cylon/Cylon.ino @@ -6,7 +6,7 @@ // For led chips like Neopixels, which have a data line, ground, and power, you just // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, // ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN -#define DATA_PIN 7 +#define DATA_PIN 2 #define CLOCK_PIN 13 // Define the array of leds @@ -15,8 +15,8 @@ CRGB leds[NUM_LEDS]; void setup() { Serial.begin(57600); Serial.println("resetting"); - LEDS.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS); - LEDS.setBrightness(84); + FastLED.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS); + FastLED.setBrightness(84); } void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } } diff --git a/examples/DemoReel100/DemoReel100.ino b/examples/DemoReel100/DemoReel100.ino index b4478735..fb91edfc 100644 --- a/examples/DemoReel100/DemoReel100.ino +++ b/examples/DemoReel100/DemoReel100.ino @@ -11,9 +11,6 @@ FASTLED_USING_NAMESPACE // // -Mark Kriegsman, December 2014 -#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000) -#warning "Requires FastLED 3.1 or later; check github for latest code." -#endif #define DATA_PIN 3 //#define CLK_PIN 4 @@ -117,7 +114,7 @@ void bpm() void juggle() { // eight colored dots, weaving in and out of sync with each other fadeToBlackBy( leds, NUM_LEDS, 20); - byte dothue = 0; + uint8_t dothue = 0; for( int i = 0; i < 8; i++) { leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255); dothue += 32; diff --git a/examples/Fire2012/Fire2012.ino b/examples/Fire2012/Fire2012.ino index dec5cd7f..f008a956 100644 --- a/examples/Fire2012/Fire2012.ino +++ b/examples/Fire2012/Fire2012.ino @@ -72,7 +72,7 @@ void loop() void Fire2012() { // Array of temperature readings at each simulation cell - static byte heat[NUM_LEDS]; + static uint8_t heat[NUM_LEDS]; // Step 1. Cool down every cell a little for( int i = 0; i < NUM_LEDS; i++) { diff --git a/examples/Fire2012WithPalette/Fire2012WithPalette.ino b/examples/Fire2012WithPalette/Fire2012WithPalette.ino index e65a87fb..182a48ae 100644 --- a/examples/Fire2012WithPalette/Fire2012WithPalette.ino +++ b/examples/Fire2012WithPalette/Fire2012WithPalette.ino @@ -128,7 +128,7 @@ void loop() void Fire2012WithPalette() { // Array of temperature readings at each simulation cell - static byte heat[NUM_LEDS]; + static uint8_t heat[NUM_LEDS]; // Step 1. Cool down every cell a little for( int i = 0; i < NUM_LEDS; i++) { @@ -150,7 +150,7 @@ void Fire2012WithPalette() for( int j = 0; j < NUM_LEDS; j++) { // Scale the heat value from 0-255 down to 0-240 // for best results with color palettes. - byte colorindex = scale8( heat[j], 240); + uint8_t colorindex = scale8( heat[j], 240); CRGB color = ColorFromPalette( gPal, colorindex); int pixelnumber; if( gReverseDirection ) { diff --git a/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino b/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino index 3b7a9c79..0189f49e 100644 --- a/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino +++ b/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino @@ -12,14 +12,14 @@ CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP]; // For mirroring strips, all the "special" stuff happens just in setup. We // just addLeds multiple times, once for each strip void setup() { - // tell FastLED there's 60 NEOPIXEL leds on pin 10 - FastLED.addLeds<NEOPIXEL, 10>(leds[0], NUM_LEDS_PER_STRIP); + // tell FastLED there's 60 NEOPIXEL leds on pin 2 + FastLED.addLeds<NEOPIXEL, 2>(leds[0], NUM_LEDS_PER_STRIP); - // tell FastLED there's 60 NEOPIXEL leds on pin 11 - FastLED.addLeds<NEOPIXEL, 11>(leds[1], NUM_LEDS_PER_STRIP); + // tell FastLED there's 60 NEOPIXEL leds on pin 3 + FastLED.addLeds<NEOPIXEL, 3>(leds[1], NUM_LEDS_PER_STRIP); - // tell FastLED there's 60 NEOPIXEL leds on pin 12 - FastLED.addLeds<NEOPIXEL, 12>(leds[2], NUM_LEDS_PER_STRIP); + // tell FastLED there's 60 NEOPIXEL leds on pin 4 + FastLED.addLeds<NEOPIXEL, 4>(leds[2], NUM_LEDS_PER_STRIP); } diff --git a/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino b/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino index 15d58bcb..c4426ddb 100644 --- a/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino +++ b/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino @@ -13,14 +13,14 @@ CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; // For mirroring strips, all the "special" stuff happens just in setup. We // just addLeds multiple times, once for each strip void setup() { - // tell FastLED there's 60 NEOPIXEL leds on pin 10, starting at index 0 in the led array - FastLED.addLeds<NEOPIXEL, 10>(leds, 0, NUM_LEDS_PER_STRIP); + // tell FastLED there's 60 NEOPIXEL leds on pin 2, starting at index 0 in the led array + FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP); - // tell FastLED there's 60 NEOPIXEL leds on pin 11, starting at index 60 in the led array - FastLED.addLeds<NEOPIXEL, 11>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); + // tell FastLED there's 60 NEOPIXEL leds on pin 3, starting at index 60 in the led array + FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); - // tell FastLED there's 60 NEOPIXEL leds on pin 12, starting at index 120 in the led array - FastLED.addLeds<NEOPIXEL, 12>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); + // tell FastLED there's 60 NEOPIXEL leds on pin 4, starting at index 120 in the led array + FastLED.addLeds<NEOPIXEL, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); } diff --git a/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino b/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino index d8d73fe2..68190fe4 100644 --- a/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino +++ b/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino @@ -11,8 +11,8 @@ CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; // OctoWS2811: 2,14,7,8,6,20,21,5 void setup() { - LEDS.addLeds<OCTOWS2811>(leds, NUM_LEDS_PER_STRIP); - LEDS.setBrightness(32); + FastLED.addLeds<OCTOWS2811>(leds, NUM_LEDS_PER_STRIP); + FastLED.setBrightness(32); } void loop() { @@ -32,6 +32,6 @@ void loop() { hue++; - LEDS.show(); - LEDS.delay(10); + FastLED.show(); + FastLED.delay(10); } diff --git a/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino b/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino index 8c447b54..4cd5d628 100644 --- a/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino +++ b/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino @@ -24,13 +24,13 @@ void setup() { delay(5000); Serial.begin(57600); Serial.println("Starting..."); - // LEDS.addLeds<WS2811_PORTA,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); - // LEDS.addLeds<WS2811_PORTB,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); - // LEDS.addLeds<WS2811_PORTD,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); - LEDS.addLeds<WS2811_PORTDC,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); + // FastLED.addLeds<WS2811_PORTA,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); + // FastLED.addLeds<WS2811_PORTB,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); + // FastLED.addLeds<WS2811_PORTD,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); + FastLED.addLeds<WS2811_PORTDC,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); // Teensy 4 parallel output example - // LEDS.addLeds<NUM_STRIPS, WS2811, 1>(leds,NUM_LEDS_PER_STRIP); + // FastLED.addLeds<NUM_STRIPS, WS2811, 1>(leds,NUM_LEDS_PER_STRIP); } void loop() { @@ -51,6 +51,6 @@ void loop() { hue++; - LEDS.show(); - // LEDS.delay(100); + FastLED.show(); + // FastLED.delay(100); } diff --git a/examples/Noise/Noise.ino b/examples/Noise/Noise.ino index e196e6bb..f11d75d7 100644 --- a/examples/Noise/Noise.ino +++ b/examples/Noise/Noise.ino @@ -7,8 +7,10 @@ // Params for width and height const uint8_t kMatrixWidth = 16; const uint8_t kMatrixHeight = 16; + #define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight) #define NUM_LEDS (kMatrixWidth * kMatrixHeight) + // Param for different pixel layouts const bool kMatrixSerpentineLayout = true; @@ -62,15 +64,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,5,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 +109,6 @@ void loop() { } ihue+=1; - LEDS.show(); + FastLED.show(); // delay(10); } diff --git a/examples/NoisePlayground/NoisePlayground.ino b/examples/NoisePlayground/NoisePlayground.ino index e2c7cb31..6c047324 100644 --- a/examples/NoisePlayground/NoisePlayground.ino +++ b/examples/NoisePlayground/NoisePlayground.ino @@ -1,9 +1,11 @@ #include <FastLED.h> -#define kMatrixWidth 16 -#define kMatrixHeight 16 +// Params for width and height +const uint8_t kMatrixWidth = 16; +const uint8_t kMatrixHeight = 16; #define NUM_LEDS (kMatrixWidth * kMatrixHeight) + // Param for different pixel layouts #define kMatrixSerpentineLayout true @@ -37,11 +39,11 @@ int y_speed=1111; void loop() { // fill the led array 2/16-bit noise values - fill_2dnoise16(LEDS.leds(), kMatrixWidth, kMatrixHeight, kMatrixSerpentineLayout, + fill_2dnoise16(leds, kMatrixWidth, kMatrixHeight, kMatrixSerpentineLayout, octaves,x,xscale,y,yscale,v_time, hue_octaves,hxy,hue_scale,hxy,hue_scale,hue_time, false); - LEDS.show(); + FastLED.show(); // adjust the intra-frame time values x += x_speed; @@ -61,8 +63,8 @@ void setup() { Serial.println("resetting!"); delay(3000); - LEDS.addLeds<WS2811,6,GRB>(leds,NUM_LEDS); - LEDS.setBrightness(96); + FastLED.addLeds<WS2811,2,GRB>(leds,NUM_LEDS); + FastLED.setBrightness(96); hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); x = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); diff --git a/examples/NoisePlusPalette/NoisePlusPalette.ino b/examples/NoisePlusPalette/NoisePlusPalette.ino index e95e4128..4670cc38 100644 --- a/examples/NoisePlusPalette/NoisePlusPalette.ino +++ b/examples/NoisePlusPalette/NoisePlusPalette.ino @@ -5,8 +5,11 @@ #define LED_TYPE WS2811 #define COLOR_ORDER GRB +// Params for width and height const uint8_t kMatrixWidth = 16; const uint8_t kMatrixHeight = 16; + +// Param for different pixel layouts const bool kMatrixSerpentineLayout = true; @@ -67,8 +70,8 @@ uint8_t colorLoop = 1; void setup() { delay(3000); - LEDS.addLeds<LED_TYPE,LED_PIN,COLOR_ORDER>(leds,NUM_LEDS); - LEDS.setBrightness(BRIGHTNESS); + FastLED.addLeds<LED_TYPE,LED_PIN,COLOR_ORDER>(leds,NUM_LEDS); + FastLED.setBrightness(BRIGHTNESS); // Initialize our coordinates to some random values x = random16(); @@ -163,7 +166,7 @@ void loop() { // using the current palette mapNoiseToLEDsUsingPalette(); - LEDS.show(); + FastLED.show(); // delay(10); } diff --git a/examples/RGBSetDemo/RGBSetDemo.ino b/examples/RGBSetDemo/RGBSetDemo.ino index 455fdccc..42478757 100644 --- a/examples/RGBSetDemo/RGBSetDemo.ino +++ b/examples/RGBSetDemo/RGBSetDemo.ino @@ -3,7 +3,7 @@ CRGBArray<NUM_LEDS> leds; -void setup() { FastLED.addLeds<NEOPIXEL,6>(leds, NUM_LEDS); } +void setup() { FastLED.addLeds<NEOPIXEL,2>(leds, NUM_LEDS); } void loop(){ static uint8_t hue; diff --git a/examples/SmartMatrix/SmartMatrix.ino b/examples/SmartMatrix/SmartMatrix.ino index 50bcb811..e685cf67 100644 --- a/examples/SmartMatrix/SmartMatrix.ino +++ b/examples/SmartMatrix/SmartMatrix.ino @@ -63,8 +63,8 @@ void setup() { // Serial.begin(38400); // Serial.println("resetting!"); delay(3000); - LEDS.addLeds<SMART_MATRIX>(leds,NUM_LEDS); - LEDS.setBrightness(96); + FastLED.addLeds<SMART_MATRIX>(leds,NUM_LEDS); + FastLED.setBrightness(96); // Initialize our coordinates to some random values x = random16(); @@ -116,6 +116,6 @@ void loop() { pSmartMatrix->fillCircle(circlex % 32,circley % 32,6,CRGB(CHSV(ihue+128,255,255))); circlex += random16(2); circley += random16(2); - LEDS.show(); + FastLED.show(); // delay(10); } diff --git a/examples/TwinkleFox/TwinkleFox.ino b/examples/TwinkleFox/TwinkleFox.ino index 4821139b..89af25c5 100644 --- a/examples/TwinkleFox/TwinkleFox.ino +++ b/examples/TwinkleFox/TwinkleFox.ino @@ -1,9 +1,5 @@ #include "FastLED.h" -#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000) -#warning "Requires FastLED 3.1 or later; check github for latest code." -#endif - #define NUM_LEDS 100 #define LED_TYPE WS2811 diff --git a/examples/XYMatrix/XYMatrix.ino b/examples/XYMatrix/XYMatrix.ino index 010ffe7c..cce1fbf3 100644 --- a/examples/XYMatrix/XYMatrix.ino +++ b/examples/XYMatrix/XYMatrix.ino @@ -15,7 +15,7 @@ // No error checking is performed on the ranges of x and y. // // XYsafe(x,y) takes x and y coordinates and returns an LED index number, -// for use like this: leds[ XY(x,y) ] == CRGB::Red; +// for use like this: leds[ XYsafe(x,y) ] == CRGB::Red; // Error checking IS performed on the ranges of x and y, and an // index of "-1" is returned. Special instructions below // explain how to use this without having to do your own error @@ -31,6 +31,7 @@ const uint8_t kMatrixHeight = 16; // Param for different pixel layouts const bool kMatrixSerpentineLayout = true; const bool kMatrixVertical = false; + // Set 'kMatrixSerpentineLayout' to false if your pixels are // laid out all running the same way, like this: // @@ -189,13 +190,13 @@ void loop() FastLED.show(); } -void DrawOneFrame( byte startHue8, int8_t yHueDelta8, int8_t xHueDelta8) +void DrawOneFrame( uint8_t startHue8, int8_t yHueDelta8, int8_t xHueDelta8) { - byte lineStartHue = startHue8; - for( byte y = 0; y < kMatrixHeight; y++) { + uint8_t lineStartHue = startHue8; + for( uint8_t y = 0; y < kMatrixHeight; y++) { lineStartHue += yHueDelta8; - byte pixelHue = lineStartHue; - for( byte x = 0; x < kMatrixWidth; x++) { + uint8_t pixelHue = lineStartHue; + for( uint8_t x = 0; x < kMatrixWidth; x++) { pixelHue += xHueDelta8; leds[ XY(x, y)] = CHSV( pixelHue, 255, 255); } |