3386

帖子

0

TA的资源

五彩晶圆(中级)

41
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  项目程序之九:快速淡入淡出循环变色

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序之九:快速淡入淡出循环变色
  • */
  • #include <FastLED.h>
  • // How many leds in your strip?
  • #define NUM_LEDS 256
  • // 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 6
  • //#define CLOCK_PIN 13
  • // Define the array of leds
  • CRGB leds[NUM_LEDS];
  • void setup() {
  • Serial.begin(57600);
  • Serial.println("resetting");
  • FastLED.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
  • FastLED.setBrightness(24);
  • }
  • void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
  • void loop() {
  • static uint8_t hue = 0;
  • Serial.print("x");
  • // First slide the led in one direction
  • for(int i = 0; i < NUM_LEDS; i++) {
  • // Set the i'th led to red
  • leds[i] = CHSV(hue++, 255, 255);
  • // Show the leds
  • FastLED.show();
  • // now that we've shown the leds, reset the i'th led to black
  • // leds[i] = CRGB::Black;
  • fadeall();
  • // Wait a little bit before we loop around and do it again
  • delay(10);
  • }
  • Serial.print("x");
  • // Now go in the other direction.
  • for(int i = (NUM_LEDS)-1; i >= 0; i--) {
  • // Set the i'th led to red
  • leds[i] = CHSV(hue++, 255, 255);
  • // Show the leds
  • FastLED.show();
  • // now that we've shown the leds, reset the i'th led to black
  • // leds[i] = CRGB::Black;
  • fadeall();
  • // Wait a little bit before we loop around and do it again
  • delay(10);
  • }
  • }

 

 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

42
 

实验场景图  动态图

 

 

 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

43
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序之十:FastLED“100行代码”演示卷轴动画效果

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序之十:FastLED“100行代码”演示卷轴动画效果
  • */
  • #include <FastLED.h>
  • FASTLED_USING_NAMESPACE
  • // FastLED "100-lines-of-code" demo reel, showing just a few
  • // of the kinds of animation patterns you can quickly and easily
  • // compose using FastLED.
  • //
  • // This example also shows one easy way to define multiple
  • // animations patterns and have them automatically rotate.
  • //
  • // -Mark Kriegsman, December 2014
  • #define DATA_PIN 6
  • //#define CLK_PIN 4
  • #define LED_TYPE WS2811
  • #define COLOR_ORDER GRB
  • #define NUM_LEDS 256
  • CRGB leds[NUM_LEDS];
  • #define BRIGHTNESS 26
  • #define FRAMES_PER_SECOND 120
  • void setup() {
  • delay(500); // 3 second delay for recovery
  • // tell FastLED about the LED strip configuration
  • FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  • //FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  • // set master brightness control
  • FastLED.setBrightness(BRIGHTNESS);
  • }
  • // List of patterns to cycle through. Each is defined as a separate function below.
  • typedef void (*SimplePatternList[])();
  • SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
  • uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
  • uint8_t gHue = 0; // rotating "base color" used by many of the patterns
  • void loop()
  • {
  • // Call the current pattern function once, updating the 'leds' array
  • gPatterns[gCurrentPatternNumber]();
  • // send the 'leds' array out to the actual LED strip
  • FastLED.show();
  • // insert a delay to keep the framerate modest
  • FastLED.delay(500/FRAMES_PER_SECOND);
  • // do some periodic updates
  • EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow
  • EVERY_N_SECONDS( 10 ) { nextPattern(); } // change patterns periodically
  • }
  • #define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
  • void nextPattern()
  • {
  • // add one to the current pattern number, and wrap around at the end
  • gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
  • }
  • void rainbow()
  • {
  • // FastLED's built-in rainbow generator
  • fill_rainbow( leds, NUM_LEDS, gHue, 7);
  • }
  • void rainbowWithGlitter()
  • {
  • // built-in FastLED rainbow, plus some random sparkly glitter
  • rainbow();
  • addGlitter(80);
  • }
  • void addGlitter( fract8 chanceOfGlitter)
  • {
  • if( random8() < chanceOfGlitter) {
  • leds[ random16(NUM_LEDS) ] += CRGB::White;
  • }
  • }
  • void confetti()
  • {
  • // random colored speckles that blink in and fade smoothly
  • fadeToBlackBy( leds, NUM_LEDS, 10);
  • int pos = random16(NUM_LEDS);
  • leds[pos] += CHSV( gHue + random8(256), 200, 255);
  • }
  • void sinelon()
  • {
  • // a colored dot sweeping back and forth, with fading trails
  • fadeToBlackBy( leds, NUM_LEDS, 20);
  • int pos = beatsin16( 13, 0, NUM_LEDS-1 );
  • leds[pos] += CHSV( gHue, 255, 192);
  • }
  • void bpm()
  • {
  • // colored stripes pulsing at a defined Beats-Per-Minute (BPM)
  • uint8_t BeatsPerMinute = 62;
  • CRGBPalette16 palette = PartyColors_p;
  • uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
  • for( int i = 0; i < NUM_LEDS; i++) { //9948
  • leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
  • }
  • }
  • void juggle() {
  • // eight colored dots, weaving in and out of sync with each other
  • fadeToBlackBy( leds, NUM_LEDS, 20);
  • 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;
  • }
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

44
 

实验场景图  动态图

 

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

45
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序十一:骄傲2015动画,不断变化的彩虹

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序十一:骄傲2015动画,不断变化的彩虹
  • */
  • #include "FastLED.h"
  • // Pride2015
  • // Animated, ever-changing rainbows.
  • // by Mark Kriegsman
  • #if FASTLED_VERSION < 3001000
  • #error "Requires FastLED 3.1 or later; check github for latest code."
  • #endif
  • #define DATA_PIN 6
  • //#define CLK_PIN 4
  • #define LED_TYPE WS2811
  • #define COLOR_ORDER GRB
  • #define NUM_LEDS 256
  • #define BRIGHTNESS 22
  • CRGB leds[NUM_LEDS];
  • void setup() {
  • delay(1000); // 3 second delay for recovery
  • // tell FastLED about the LED strip configuration
  • FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS)
  • .setCorrection(TypicalLEDStrip)
  • .setDither(BRIGHTNESS < 255);
  • // set master brightness control
  • FastLED.setBrightness(BRIGHTNESS);
  • }
  • void loop()
  • {
  • pride();
  • FastLED.show();
  • }
  • // This function draws rainbows with an ever-changing,
  • // widely-varying set of parameters.
  • void pride()
  • {
  • static uint16_t sPseudotime = 0;
  • static uint16_t sLastMillis = 0;
  • static uint16_t sHue16 = 0;
  • uint8_t sat8 = beatsin88( 87, 220, 250);
  • uint8_t brightdepth = beatsin88( 341, 96, 224);
  • uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
  • uint8_t msmultiplier = beatsin88(147, 23, 60);
  • uint16_t hue16 = sHue16;//gHue * 256;
  • uint16_t hueinc16 = beatsin88(113, 1, 3000);
  • uint16_t ms = millis();
  • uint16_t deltams = ms - sLastMillis ;
  • sLastMillis = ms;
  • sPseudotime += deltams * msmultiplier;
  • sHue16 += deltams * beatsin88( 400, 5,9);
  • uint16_t brightnesstheta16 = sPseudotime;
  • for( uint16_t i = 0 ; i < NUM_LEDS; i++) {
  • hue16 += hueinc16;
  • uint8_t hue8 = hue16 / 256;
  • brightnesstheta16 += brightnessthetainc16;
  • uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
  • uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
  • uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
  • bri8 += (255 - brightdepth);
  • CRGB newcolor = CHSV( hue8, sat8, bri8);
  • uint16_t pixelnumber = i;
  • pixelnumber = (NUM_LEDS-1) - pixelnumber;
  • nblend( leds[pixelnumber], newcolor, 64);
  • }
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

46
 

实验场景图

 

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

47
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序十二:TwinkleFOX-淡入淡出的闪烁“假日”灯

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序十二:TwinkleFOX-淡入淡出的闪烁“假日”灯
  • */
  • #include "FastLED.h"
  • #define NUM_LEDS 256
  • #define LED_TYPE WS2811
  • #define COLOR_ORDER GRB
  • #define DATA_PIN 6
  • //#define CLK_PIN 4
  • #define VOLTS 12
  • #define MAX_MA 4000
  • // TwinkleFOX: Twinkling 'holiday' lights that fade in and out.
  • // Colors are chosen from a palette; a few palettes are provided.
  • //
  • // This December 2015 implementation improves on the December 2014 version
  • // in several ways:
  • // - smoother fading, compatible with any colors and any palettes
  • // - easier control of twinkle speed and twinkle density
  • // - supports an optional 'background color'
  • // - takes even less RAM: zero RAM overhead per pixel
  • // - illustrates a couple of interesting techniques (uh oh...)
  • //
  • // The idea behind this (new) implementation is that there's one
  • // basic, repeating pattern that each pixel follows like a waveform:
  • // The brightness rises from 0..255 and then falls back down to 0.
  • // The brightness at any given point in time can be determined as
  • // as a function of time, for example:
  • // brightness = sine( time ); // a sine wave of brightness over time
  • //
  • // So the way this implementation works is that every pixel follows
  • // the exact same wave function over time. In this particular case,
  • // I chose a sawtooth triangle wave (triwave8) rather than a sine wave,
  • // but the idea is the same: brightness = triwave8( time ).
  • //
  • // Of course, if all the pixels used the exact same wave form, and
  • // if they all used the exact same 'clock' for their 'time base', all
  • // the pixels would brighten and dim at once -- which does not look
  • // like twinkling at all.
  • //
  • // So to achieve random-looking twinkling, each pixel is given a
  • // slightly different 'clock' signal. Some of the clocks run faster,
  • // some run slower, and each 'clock' also has a random offset from zero.
  • // The net result is that the 'clocks' for all the pixels are always out
  • // of sync from each other, producing a nice random distribution
  • // of twinkles.
  • //
  • // The 'clock speed adjustment' and 'time offset' for each pixel
  • // are generated randomly. One (normal) approach to implementing that
  • // would be to randomly generate the clock parameters for each pixel
  • // at startup, and store them in some arrays. However, that consumes
  • // a great deal of precious RAM, and it turns out to be totally
  • // unnessary! If the random number generate is 'seeded' with the
  • // same starting value every time, it will generate the same sequence
  • // of values every time. So the clock adjustment parameters for each
  • // pixel are 'stored' in a pseudo-random number generator! The PRNG
  • // is reset, and then the first numbers out of it are the clock
  • // adjustment parameters for the first pixel, the second numbers out
  • // of it are the parameters for the second pixel, and so on.
  • // In this way, we can 'store' a stable sequence of thousands of
  • // random clock adjustment parameters in literally two bytes of RAM.
  • //
  • // There's a little bit of fixed-point math involved in applying the
  • // clock speed adjustments, which are expressed in eighths. Each pixel's
  • // clock speed ranges from 8/8ths of the system clock (i.e. 1x) to
  • // 23/8ths of the system clock (i.e. nearly 3x).
  • //
  • // On a basic Arduino Uno or Leonardo, this code can twinkle 300+ pixels
  • // smoothly at over 50 updates per seond.
  • //
  • // -Mark Kriegsman, December 2015
  • CRGBArray<NUM_LEDS> leds;
  • // Overall twinkle speed.
  • // 0 (VERY slow) to 8 (VERY fast).
  • // 4, 5, and 6 are recommended, default is 4.
  • #define TWINKLE_SPEED 4
  • // Overall twinkle density.
  • // 0 (NONE lit) to 8 (ALL lit at once).
  • // Default is 5.
  • #define TWINKLE_DENSITY 5
  • // How often to change color palettes.
  • #define SECONDS_PER_PALETTE 30
  • // Also: toward the bottom of the file is an array
  • // called "ActivePaletteList" which controls which color
  • // palettes are used; you can add or remove color palettes
  • // from there freely.
  • // Background color for 'unlit' pixels
  • // Can be set to CRGB::Black if desired.
  • CRGB gBackgroundColor = CRGB::Black;
  • // Example of dim incandescent fairy light background color
  • // CRGB gBackgroundColor = CRGB(CRGB::FairyLight).nscale8_video(16);
  • // If AUTO_SELECT_BACKGROUND_COLOR is set to 1,
  • // then for any palette where the first two entries
  • // are the same, a dimmed version of that color will
  • // automatically be used as the background color.
  • #define AUTO_SELECT_BACKGROUND_COLOR 0
  • // If COOL_LIKE_INCANDESCENT is set to 1, colors will
  • // fade out slighted 'reddened', similar to how
  • // incandescent bulbs change color as they get dim down.
  • #define COOL_LIKE_INCANDESCENT 1
  • CRGBPalette16 gCurrentPalette;
  • CRGBPalette16 gTargetPalette;
  • void setup() {
  • delay( 1000 ); //safety startup delay
  • FastLED.setMaxPowerInVoltsAndMilliamps( VOLTS, MAX_MA);
  • FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS)
  • .setCorrection(TypicalLEDStrip);
  • FastLED.setBrightness(23);
  • chooseNextColorPalette(gTargetPalette);
  • }
  • void loop()
  • {
  • EVERY_N_SECONDS( SECONDS_PER_PALETTE ) {
  • chooseNextColorPalette( gTargetPalette );
  • }
  • EVERY_N_MILLISECONDS( 10 ) {
  • nblendPaletteTowardPalette( gCurrentPalette, gTargetPalette, 12);
  • }
  • drawTwinkles( leds);
  • FastLED.show();
  • }
  • // This function loops over each pixel, calculates the
  • // adjusted 'clock' that this pixel should use, and calls
  • // "CalculateOneTwinkle" on each pixel. It then displays
  • // either the twinkle color of the background color,
  • // whichever is brighter.
  • void drawTwinkles( CRGBSet& L)
  • {
  • // "PRNG16" is the pseudorandom number generator
  • // It MUST be reset to the same starting value each time
  • // this function is called, so that the sequence of 'random'
  • // numbers that it generates is (paradoxically) stable.
  • uint16_t PRNG16 = 11337;
  • uint32_t clock32 = millis();
  • // Set up the background color, "bg".
  • // if AUTO_SELECT_BACKGROUND_COLOR == 1, and the first two colors of
  • // the current palette are identical, then a deeply faded version of
  • // that color is used for the background color
  • CRGB bg;
  • if ( (AUTO_SELECT_BACKGROUND_COLOR == 1) &&
  • (gCurrentPalette[0] == gCurrentPalette[1] )) {
  • bg = gCurrentPalette[0];
  • uint8_t bglight = bg.getAverageLight();
  • if ( bglight > 64) {
  • bg.nscale8_video( 16); // very bright, so scale to 1/16th
  • } else if ( bglight > 16) {
  • bg.nscale8_video( 64); // not that bright, so scale to 1/4th
  • } else {
  • bg.nscale8_video( 86); // dim, scale to 1/3rd.
  • }
  • } else {
  • bg = gBackgroundColor; // just use the explicitly defined background color
  • }
  • uint8_t backgroundBrightness = bg.getAverageLight();
  • for ( CRGB& pixel : L) {
  • PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
  • uint16_t myclockoffset16 = PRNG16; // use that number as clock offset
  • PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
  • // use that number as clock speed adjustment factor (in 8ths, from 8/8ths to 23/8ths)
  • uint8_t myspeedmultiplierQ5_3 = ((((PRNG16 & 0xFF) >> 4) + (PRNG16 & 0x0F)) & 0x0F) + 0x08;
  • uint32_t myclock30 = (uint32_t)((clock32 * myspeedmultiplierQ5_3) >> 3) + myclockoffset16;
  • uint8_t myunique8 = PRNG16 >> 8; // get 'salt' value for this pixel
  • // We now have the adjusted 'clock' for this pixel, now we call
  • // the function that computes what color the pixel should be based
  • // on the "brightness = f( time )" idea.
  • CRGB c = computeOneTwinkle( myclock30, myunique8);
  • uint8_t cbright = c.getAverageLight();
  • int16_t deltabright = cbright - backgroundBrightness;
  • if ( deltabright >= 32 || (!bg)) {
  • // If the new pixel is significantly brighter than the background color,
  • // use the new color.
  • pixel = c;
  • } else if ( deltabright > 0 ) {
  • // If the new pixel is just slightly brighter than the background color,
  • // mix a blend of the new color and the background color
  • pixel = blend( bg, c, deltabright * 8);
  • } else {
  • // if the new pixel is not at all brighter than the background color,
  • // just use the background color.
  • pixel = bg;
  • }
  • }
  • }
  • // This function takes a time in pseudo-milliseconds,
  • // figures out brightness = f( time ), and also hue = f( time )
  • // The 'low digits' of the millisecond time are used as
  • // input to the brightness wave function.
  • // The 'high digits' are used to select a color, so that the color
  • // does not change over the course of the fade-in, fade-out
  • // of one cycle of the brightness wave function.
  • // The 'high digits' are also used to determine whether this pixel
  • // should light at all during this cycle, based on the TWINKLE_DENSITY.
  • CRGB computeOneTwinkle( uint32_t ms, uint8_t salt)
  • {
  • uint16_t ticks = ms >> (8 - TWINKLE_SPEED);
  • uint8_t fastcycle8 = ticks;
  • uint16_t slowcycle16 = (ticks >> 8) + salt;
  • slowcycle16 += sin8( slowcycle16);
  • slowcycle16 = (slowcycle16 * 2053) + 1384;
  • uint8_t slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8);
  • uint8_t bright = 0;
  • if ( ((slowcycle8 & 0x0E) / 2) < TWINKLE_DENSITY) {
  • bright = attackDecayWave8( fastcycle8);
  • }
  • uint8_t hue = slowcycle8 - salt;
  • CRGB c;
  • if ( bright > 0) {
  • c = ColorFromPalette( gCurrentPalette, hue, bright, NOBLEND);
  • if ( COOL_LIKE_INCANDESCENT == 1 ) {
  • coolLikeIncandescent( c, fastcycle8);
  • }
  • } else {
  • c = CRGB::Black;
  • }
  • return c;
  • }
  • // This function is like 'triwave8', which produces a
  • // symmetrical up-and-down triangle sawtooth waveform, except that this
  • // function produces a triangle wave with a faster attack and a slower decay:
  • //
  • // / \
  • // / \
  • // / \
  • // / \
  • //
  • uint8_t attackDecayWave8( uint8_t i)
  • {
  • if ( i < 86) {
  • return i * 3;
  • } else {
  • i -= 86;
  • return 255 - (i + (i / 2));
  • }
  • }
  • // This function takes a pixel, and if its in the 'fading down'
  • // part of the cycle, it adjusts the color a little bit like the
  • // way that incandescent bulbs fade toward 'red' as they dim.
  • void coolLikeIncandescent( CRGB& c, uint8_t phase)
  • {
  • if ( phase < 128) return;
  • uint8_t cooling = (phase - 128) >> 4;
  • c.g = qsub8( c.g, cooling);
  • c.b = qsub8( c.b, cooling * 2);
  • }
  • // A mostly red palette with green accents and white trim.
  • // "CRGB::Gray" is used as white to keep the brightness more uniform.
  • const TProgmemRGBPalette16 RedGreenWhite_p FL_PROGMEM =
  • { CRGB::Red, CRGB::Red, CRGB::Red, CRGB::Red,
  • CRGB::Red, CRGB::Red, CRGB::Red, CRGB::Red,
  • CRGB::Red, CRGB::Red, CRGB::Gray, CRGB::Gray,
  • CRGB::Green, CRGB::Green, CRGB::Green, CRGB::Green
  • };
  • // A mostly (dark) green palette with red berries.
  • #define Holly_Green 0x00580c
  • #define Holly_Red 0xB00402
  • const TProgmemRGBPalette16 Holly_p FL_PROGMEM =
  • { Holly_Green, Holly_Green, Holly_Green, Holly_Green,
  • Holly_Green, Holly_Green, Holly_Green, Holly_Green,
  • Holly_Green, Holly_Green, Holly_Green, Holly_Green,
  • Holly_Green, Holly_Green, Holly_Green, Holly_Red
  • };
  • // A red and white striped palette
  • // "CRGB::Gray" is used as white to keep the brightness more uniform.
  • const TProgmemRGBPalette16 RedWhite_p FL_PROGMEM =
  • { CRGB::Red, CRGB::Red, CRGB::Red, CRGB::Red,
  • CRGB::Gray, CRGB::Gray, CRGB::Gray, CRGB::Gray,
  • CRGB::Red, CRGB::Red, CRGB::Red, CRGB::Red,
  • CRGB::Gray, CRGB::Gray, CRGB::Gray, CRGB::Gray
  • };
  • // A mostly blue palette with white accents.
  • // "CRGB::Gray" is used as white to keep the brightness more uniform.
  • const TProgmemRGBPalette16 BlueWhite_p FL_PROGMEM =
  • { CRGB::Blue, CRGB::Blue, CRGB::Blue, CRGB::Blue,
  • CRGB::Blue, CRGB::Blue, CRGB::Blue, CRGB::Blue,
  • CRGB::Blue, CRGB::Blue, CRGB::Blue, CRGB::Blue,
  • CRGB::Blue, CRGB::Gray, CRGB::Gray, CRGB::Gray
  • };
  • // A pure "fairy light" palette with some brightness variations
  • #define HALFFAIRY ((CRGB::FairyLight & 0xFEFEFE) / 2)
  • #define QUARTERFAIRY ((CRGB::FairyLight & 0xFCFCFC) / 4)
  • const TProgmemRGBPalette16 FairyLight_p FL_PROGMEM =
  • { CRGB::FairyLight, CRGB::FairyLight, CRGB::FairyLight, CRGB::FairyLight,
  • HALFFAIRY, HALFFAIRY, CRGB::FairyLight, CRGB::FairyLight,
  • QUARTERFAIRY, QUARTERFAIRY, CRGB::FairyLight, CRGB::FairyLight,
  • CRGB::FairyLight, CRGB::FairyLight, CRGB::FairyLight, CRGB::FairyLight
  • };
  • // A palette of soft snowflakes with the occasional bright one
  • const TProgmemRGBPalette16 Snow_p FL_PROGMEM =
  • { 0x304048, 0x304048, 0x304048, 0x304048,
  • 0x304048, 0x304048, 0x304048, 0x304048,
  • 0x304048, 0x304048, 0x304048, 0x304048,
  • 0x304048, 0x304048, 0x304048, 0xE0F0FF
  • };
  • // A palette reminiscent of large 'old-school' C9-size tree lights
  • // in the five classic colors: red, orange, green, blue, and white.
  • #define C9_Red 0xB80400
  • #define C9_Orange 0x902C02
  • #define C9_Green 0x046002
  • #define C9_Blue 0x070758
  • #define C9_White 0x606820
  • const TProgmemRGBPalette16 RetroC9_p FL_PROGMEM =
  • { C9_Red, C9_Orange, C9_Red, C9_Orange,
  • C9_Orange, C9_Red, C9_Orange, C9_Red,
  • C9_Green, C9_Green, C9_Green, C9_Green,
  • C9_Blue, C9_Blue, C9_Blue,
  • C9_White
  • };
  • // A cold, icy pale blue palette
  • #define Ice_Blue1 0x0C1040
  • #define Ice_Blue2 0x182080
  • #define Ice_Blue3 0x5080C0
  • const TProgmemRGBPalette16 Ice_p FL_PROGMEM =
  • {
  • Ice_Blue1, Ice_Blue1, Ice_Blue1, Ice_Blue1,
  • Ice_Blue1, Ice_Blue1, Ice_Blue1, Ice_Blue1,
  • Ice_Blue1, Ice_Blue1, Ice_Blue1, Ice_Blue1,
  • Ice_Blue2, Ice_Blue2, Ice_Blue2, Ice_Blue3
  • };
  • // Add or remove palette names from this list to control which color
  • // palettes are used, and in what order.
  • const TProgmemRGBPalette16* ActivePaletteList[] = {
  • &RetroC9_p,
  • &BlueWhite_p,
  • &RainbowColors_p,
  • &FairyLight_p,
  • &RedGreenWhite_p,
  • &PartyColors_p,
  • &RedWhite_p,
  • &Snow_p,
  • &Holly_p,
  • &Ice_p
  • };
  • // Advance to the next color palette in the list (above).
  • void chooseNextColorPalette( CRGBPalette16& pal)
  • {
  • const uint8_t numberOfPalettes = sizeof(ActivePaletteList) / sizeof(ActivePaletteList[0]);
  • static uint8_t whichPalette = -1;
  • whichPalette = addmod8( whichPalette, 1, numberOfPalettes);
  • pal = *(ActivePaletteList[whichPalette]);
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

48
 

实验场景图

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

49
 
lugl4313820 发表于 2022-10-21 19:00 看到了一双苍霜的老手!

喜欢干活的劳动之手,呵呵

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

50
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序十三:随机不同像素布局的xy矩阵

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序十三:随机不同像素布局的xy矩阵
  • */
  • #include <FastLED.h>
  • // Params for width and height
  • const uint8_t kMatrixWidth = 8;
  • const uint8_t kMatrixHeight = 32;
  • #define NUM_LEDS (kMatrixWidth * kMatrixHeight)
  • // Param for different pixel layouts
  • #define kMatrixSerpentineLayout true
  • // led array
  • CRGB leds[kMatrixWidth * kMatrixHeight];
  • // x,y, & time values
  • 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=1;
  • uint8_t hue_octaves=3;
  • // the 'distance' between points on the x and y axis
  • 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=1111;
  • int hue_speed=31;
  • // adjust these values to move along the x or y axis between frames
  • int x_speed=331;
  • int y_speed=1111;
  • void loop() {
  • // fill the led array 2/16-bit noise values
  • fill_2dnoise16(leds, kMatrixWidth, kMatrixHeight, kMatrixSerpentineLayout,
  • octaves,x,xscale,y,yscale,v_time,
  • hue_octaves,hxy,hue_scale,hxy,hue_scale,hue_time, false);
  • FastLED.show();
  • // adjust the intra-frame time values
  • x += x_speed;
  • y += y_speed;
  • v_time += time_speed;
  • hue_time += hue_speed;
  • // delay(50);
  • }
  • void setup() {
  • // initialize the x/y and time values
  • random16_set_seed(8934);
  • random16_add_entropy(analogRead(3));
  • Serial.begin(57600);
  • Serial.println("resetting!");
  • delay(3000);
  • FastLED.addLeds<WS2811,6,GRB>(leds,NUM_LEDS);
  • FastLED.setBrightness(36);
  • 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();
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

51
 

实验场景图

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

52
 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

53
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序十四:将噪声数据转换为 LED 阵列中的动态颜色

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序十四:将噪声数据转换为 LED 阵列中的动态颜色
  • */
  • #include <FastLED.h>
  • #define LED_PIN 6
  • #define BRIGHTNESS 26
  • #define LED_TYPE WS2811
  • #define COLOR_ORDER GRB
  • // Params for width and height
  • const uint8_t kMatrixWidth = 8;
  • const uint8_t kMatrixHeight = 32;
  • // Param for different pixel layouts
  • const bool kMatrixSerpentineLayout = true;
  • // This example combines two features of FastLED to produce a remarkable range of
  • // effects from a relatively small amount of code. This example combines FastLED's
  • // color palette lookup functions with FastLED's Perlin noise generator, and
  • // the combination is extremely powerful.
  • //
  • // You might want to look at the "ColorPalette" and "Noise" examples separately
  • // if this example code seems daunting.
  • //
  • //
  • // The basic setup here is that for each frame, we generate a new array of
  • // 'noise' data, and then map it onto the LED matrix through a color palette.
  • //
  • // Periodically, the color palette is changed, and new noise-generation parameters
  • // are chosen at the same time. In this example, specific noise-generation
  • // values have been selected to match the given color palettes; some are faster,
  • // or slower, or larger, or smaller than others, but there's no reason these
  • // parameters can't be freely mixed-and-matched.
  • //
  • // In addition, this example includes some fast automatic 'data smoothing' at
  • // lower noise speeds to help produce smoother animations in those cases.
  • //
  • // The FastLED built-in color palettes (Forest, Clouds, Lava, Ocean, Party) are
  • // used, as well as some 'hand-defined' ones, and some proceedurally generated
  • // palettes.
  • #define NUM_LEDS (kMatrixWidth * kMatrixHeight)
  • #define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight)
  • // The leds
  • CRGB leds[kMatrixWidth * kMatrixHeight];
  • // The 16 bit version of our coordinates
  • static uint16_t x;
  • static uint16_t y;
  • static uint16_t z;
  • // We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll
  • // use the z-axis for "time". speed determines how fast time moves forward. Try
  • // 1 for a very slow moving effect, or 60 for something that ends up looking like
  • // water.
  • uint16_t speed = 20; // speed is set dynamically once we've started up
  • // Scale determines how far apart the pixels in our noise matrix are. Try
  • // changing these values around to see how it affects the motion of the display. The
  • // higher the value of scale, the more "zoomed out" the noise iwll be. A value
  • // of 1 will be so zoomed in, you'll mostly see solid colors.
  • uint16_t scale = 30; // scale is set dynamically once we've started up
  • // This is the array that we keep our computed noise values in
  • uint8_t noise[MAX_DIMENSION][MAX_DIMENSION];
  • CRGBPalette16 currentPalette( PartyColors_p );
  • uint8_t colorLoop = 1;
  • void setup() {
  • delay(3000);
  • FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  • FastLED.setBrightness(BRIGHTNESS);
  • // Initialize our coordinates to some random values
  • x = random16();
  • y = random16();
  • z = random16();
  • }
  • // Fill the x/y array of 8-bit noise values using the inoise8 function.
  • void fillnoise8() {
  • // If we're runing at a low "speed", some 8-bit artifacts become visible
  • // from frame-to-frame. In order to reduce this, we can do some fast data-smoothing.
  • // The amount of data smoothing we're doing depends on "speed".
  • uint8_t dataSmoothing = 0;
  • if ( speed < 50) {
  • dataSmoothing = 200 - (speed * 4);
  • }
  • for (int i = 0; i < MAX_DIMENSION; i++) {
  • int ioffset = scale * i;
  • for (int j = 0; j < MAX_DIMENSION; j++) {
  • int joffset = scale * j;
  • uint8_t data = inoise8(x + ioffset, y + joffset, z);
  • // The range of the inoise8 function is roughly 16-238.
  • // These two operations expand those values out to roughly 0..255
  • // You can comment them out if you want the raw noise data.
  • data = qsub8(data, 16);
  • data = qadd8(data, scale8(data, 39));
  • if ( dataSmoothing ) {
  • uint8_t olddata = noise[i][j];
  • uint8_t newdata = scale8( olddata, dataSmoothing) + scale8( data, 256 - dataSmoothing);
  • data = newdata;
  • }
  • noise[i][j] = data;
  • }
  • }
  • z += speed;
  • // apply slow drift to X and Y, just for visual variation.
  • x += speed / 8;
  • y -= speed / 16;
  • }
  • void mapNoiseToLEDsUsingPalette()
  • {
  • static uint8_t ihue = 0;
  • for (int i = 0; i < kMatrixWidth; i++) {
  • for (int j = 0; j < kMatrixHeight; j++) {
  • // We use the value at the (i,j) coordinate in the noise
  • // array for our brightness, and the flipped value from (j,i)
  • // for our pixel's index into the color palette.
  • uint8_t index = noise[j][i];
  • uint8_t bri = noise[i][j];
  • // if this palette is a 'loop', add a slowly-changing base value
  • if ( colorLoop) {
  • index += ihue;
  • }
  • // brighten up, as the color palette itself often contains the
  • // light/dark dynamic range desired
  • if ( bri > 127 ) {
  • bri = 255;
  • } else {
  • bri = dim8_raw( bri * 2);
  • }
  • CRGB color = ColorFromPalette( currentPalette, index, bri);
  • leds[XY(i, j)] = color;
  • }
  • }
  • ihue += 1;
  • }
  • void loop() {
  • // Periodically choose a new palette, speed, and scale
  • ChangePaletteAndSettingsPeriodically();
  • // generate noise data
  • fillnoise8();
  • // convert the noise data to colors in the LED array
  • // using the current palette
  • mapNoiseToLEDsUsingPalette();
  • FastLED.show();
  • // delay(10);
  • }
  • // There are several different palettes of colors demonstrated here.
  • //
  • // FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
  • // OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
  • //
  • // Additionally, you can manually define your own color palettes, or you can write
  • // code that creates color palettes on the fly.
  • // 1 = 5 sec per palette
  • // 2 = 10 sec per palette
  • // etc
  • #define HOLD_PALETTES_X_TIMES_AS_LONG 1
  • void ChangePaletteAndSettingsPeriodically()
  • {
  • uint8_t secondHand = ((millis() / 1000) / HOLD_PALETTES_X_TIMES_AS_LONG) % 60;
  • static uint8_t lastSecond = 99;
  • if ( lastSecond != secondHand) {
  • lastSecond = secondHand;
  • if ( secondHand == 0) {
  • currentPalette = RainbowColors_p;
  • speed = 20;
  • scale = 30;
  • colorLoop = 1;
  • }
  • if ( secondHand == 5) {
  • SetupPurpleAndGreenPalette();
  • speed = 10;
  • scale = 50;
  • colorLoop = 1;
  • }
  • if ( secondHand == 10) {
  • SetupBlackAndWhiteStripedPalette();
  • speed = 20;
  • scale = 30;
  • colorLoop = 1;
  • }
  • if ( secondHand == 15) {
  • currentPalette = ForestColors_p;
  • speed = 8;
  • scale = 120;
  • colorLoop = 0;
  • }
  • if ( secondHand == 20) {
  • currentPalette = CloudColors_p;
  • speed = 4;
  • scale = 30;
  • colorLoop = 0;
  • }
  • if ( secondHand == 25) {
  • currentPalette = LavaColors_p;
  • speed = 8;
  • scale = 50;
  • colorLoop = 0;
  • }
  • if ( secondHand == 30) {
  • currentPalette = OceanColors_p;
  • speed = 20;
  • scale = 90;
  • colorLoop = 0;
  • }
  • if ( secondHand == 35) {
  • currentPalette = PartyColors_p;
  • speed = 20;
  • scale = 30;
  • colorLoop = 1;
  • }
  • if ( secondHand == 40) {
  • SetupRandomPalette();
  • speed = 20;
  • scale = 20;
  • colorLoop = 1;
  • }
  • if ( secondHand == 45) {
  • SetupRandomPalette();
  • speed = 50;
  • scale = 50;
  • colorLoop = 1;
  • }
  • if ( secondHand == 50) {
  • SetupRandomPalette();
  • speed = 90;
  • scale = 90;
  • colorLoop = 1;
  • }
  • if ( secondHand == 55) {
  • currentPalette = RainbowStripeColors_p;
  • speed = 30;
  • scale = 20;
  • colorLoop = 1;
  • }
  • }
  • }
  • // This function generates a random palette that's a gradient
  • // between four different colors. The first is a dim hue, the second is
  • // a bright hue, the third is a bright pastel, and the last is
  • // another bright hue. This gives some visual bright/dark variation
  • // which is more interesting than just a gradient of different hues.
  • void SetupRandomPalette()
  • {
  • currentPalette = CRGBPalette16(
  • CHSV( random8(), 255, 32),
  • CHSV( random8(), 255, 255),
  • CHSV( random8(), 128, 255),
  • CHSV( random8(), 255, 255));
  • }
  • // This function sets up a palette of black and white stripes,
  • // using code. Since the palette is effectively an array of
  • // sixteen CRGB colors, the various fill_* functions can be used
  • // to set them up.
  • void SetupBlackAndWhiteStripedPalette()
  • {
  • // 'black out' all 16 palette entries...
  • fill_solid( currentPalette, 16, CRGB::Black);
  • // and set every fourth one to white.
  • currentPalette[0] = CRGB::White;
  • currentPalette[4] = CRGB::White;
  • currentPalette[8] = CRGB::White;
  • currentPalette[12] = CRGB::White;
  • }
  • // This function sets up a palette of purple and green stripes.
  • void SetupPurpleAndGreenPalette()
  • {
  • CRGB purple = CHSV( HUE_PURPLE, 255, 255);
  • CRGB green = CHSV( HUE_GREEN, 255, 255);
  • CRGB black = CRGB::Black;
  • currentPalette = CRGBPalette16(
  • green, green, black, black,
  • purple, purple, black, black,
  • green, green, black, black,
  • purple, purple, black, black );
  • }
  • //
  • // Mark's xy coordinate mapping code. See the XYMatrix for more information on it.
  • //
  • uint16_t XY( uint8_t x, uint8_t y)
  • {
  • uint16_t i;
  • if ( kMatrixSerpentineLayout == false) {
  • i = (y * kMatrixWidth) + x;
  • }
  • if ( kMatrixSerpentineLayout == true) {
  • if ( y & 0x01) {
  • // Odd rows run backwards
  • uint8_t reverseX = (kMatrixWidth - 1) - x;
  • i = (y * kMatrixWidth) + reverseX;
  • } else {
  • // Even rows run forwards
  • i = (y * kMatrixWidth) + x;
  • }
  • }
  • return i;
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

54
 

实验场景图  动态图

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

55
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序十五:随机追逐的彗星效果

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序十五:随机追逐的彗星效果
  • */
  • #include <WS2812FX.h>
  • #define LED_COUNT 256
  • #define LED_PIN 6
  • WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
  • void setup() {
  • Serial.begin(115200);
  • ws2812fx.init();
  • ws2812fx.setBrightness(25);
  • // segment 0 is the builtin comet effect
  • ws2812fx.setSegment(0, 0, LED_COUNT / 2 - 1, FX_MODE_COMET, RED, 1000, false);
  • // segment 1 is our custom effect
  • ws2812fx.setCustomMode(myCustomEffect);
  • ws2812fx.setSegment(1, LED_COUNT / 2, LED_COUNT - 1, FX_MODE_CUSTOM, RED, 50, false);
  • ws2812fx.start();
  • }
  • void loop() {
  • ws2812fx.service();
  • }
  • uint16_t myCustomEffect(void) { // random chase
  • WS2812FX::Segment* seg = ws2812fx.getSegment(); // get the current segment
  • for (uint16_t i = seg->stop; i > seg->start; i--) {
  • ws2812fx.setPixelColor(i, ws2812fx.getPixelColor(i - 1));
  • }
  • uint32_t color = ws2812fx.getPixelColor(seg->start + 1);
  • int r = random(6) != 0 ? (color >> 16 & 0xFF) : random(256);
  • int g = random(6) != 0 ? (color >> 8 & 0xFF) : random(256);
  • int b = random(6) != 0 ? (color & 0xFF) : random(256);
  • ws2812fx.setPixelColor(seg->start, r, g, b);
  • return seg->speed; // return the delay until the next animation step (in msec)
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

56
 

实验场景图

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

57
 

  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

  实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块

  项目程序十六:WS2812FX库最简单的程序形式

 

  • /*
  • 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  • 实验二百一十四:WS2812B全彩RGB像素屏 8x32点阵LED显示屏 硬屏模块
  • 项目程序十六:WS2812FX库最简单的程序形式
  • */
  • #include <WS2812FX.h> //导入库
  • #define LED_COUNT 256 //WS2812B LED数量
  • #define LED_PIN 6 //WS2812B LED接脚
  • WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
  • void setup() {
  • ws2812fx.init(); //初始化
  • ws2812fx.setBrightness(255); //设置亮度(0-255),可以控制总电流(重要!)
  • ws2812fx.setSpeed(200); // 设置速度
  • ws2812fx.setMode(FX_MODE_FIREWORKS_RANDOM);// 设置模式(内置63种模式)
  • ws2812fx.start(); //启动
  • }
  • void loop() {
  • ws2812fx.service(); //循环运行
  • }

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

58
 

实验场景图

 

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

59
 
通过将 LED 串分成段(最多 10 个)并独立编程每个段,可以创建更复杂的效果。使用setSegment()函数对每个段的模式、颜色、速度和方向(正常或反向)进行编程:
    1. setSegment(segment index, start LED, stop LED, mode, color, speed, reverse);
    复制代码


 

请注意,某些效果使用不止一种颜色(最多三种),并通过指定颜色数组进行编程:

 

    1. setSegment(segment index, start LED, stop LED, mode, colors[], speed, reverse);
    复制代码

 

  1. //将 LED 串分成两个独立的部分
  2. uint32_t colours[] = {RED, GREEN};
  3. ws2812fx.setSegment( 0 , 0 , (LED_COUNT/ 2 )- 1 , FX_MODE_BLINK, colors, 1000 , false );
  4. ws2812fx.setSegment( 1 , LED_COUNT/ 2 , LED_COUNT- 1 , FX_MODE_BLINK, COLORS(ORANGE, PURPLE), 1000 , false );
复制代码
 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

60
 

内置效果清单
静态- 不闪烁。只是普通的旧静态灯。
闪烁- 正常闪烁。50% 开/关时间。
呼吸- 众所周知的 i-Devices 的“待机呼吸”。固定速度。
颜色擦除- 依次点亮所有 LED。然后按顺序关闭它们。重复。
颜色擦除反转 - 与 Color Wipe 相同,但交换开/关颜色。
颜色擦除反向 - 依次点亮所有 LED。然后以相反的顺序关闭它们。重复。
颜色擦除反向反向 - 与 上条相同,除了交换开/关颜色。
随机颜色擦除- 将所有 LED 依次变为随机颜色。然后用另一种颜色重新开始。
随机颜色- 以一种随机颜色点亮所有 LED。然后将它们切换到下一个随机颜色。
单动态- 以随机颜色点亮每个 LED。将一个随机的 LED 一个接一个地更改为随机颜色。
多动态- 以随机颜色点亮每个 LED。同时将所有 LED 更改为新的随机颜色。
彩虹- 通过彩虹一次循环所有 LED。
彩虹循环- 在整个 LED 串上循环彩虹。
扫描- 来回运行单个像素。
双扫描- 以相反的方向来回运行两个像素。
淡入淡出- 使 LED 灯再次亮起和(几乎)熄灭。
剧院追逐 - 剧院式爬行灯。受 Adafruit 示例的启发。
剧院追逐彩虹- 具有彩虹效果的剧院式爬行灯。受 Adafruit 示例的启发。
行车灯- 带平滑正弦过渡的行车灯效果。
闪烁- 使多个 LED 闪烁、重置、重复。
闪烁随机 - 以随机颜色闪烁几个 LED,重置,重复。
闪烁淡入淡出 - 闪烁几个 LED,然后逐渐消失。
19 / 5000
翻译结果
闪烁淡入淡出随机  - 以随机颜色闪烁几个 LED,然后逐渐消失。
闪烁- 一次闪烁一个 LED。
Flash Sparkle - 以所选颜色点亮所有 LED。随机闪烁单个白色像素。
Hyper Sparkle - 像闪光一样。更多的闪光。
频闪- 经典频闪效果。
频闪彩虹- 经典频闪效果。骑自行车穿过彩虹。
Multi Strobe - 具有不同频闪次数和暂停的频闪效果,由速度设置控制。
闪烁彩虹- 经典闪烁效果。骑自行车穿过彩虹。
Chase White - 在白色上运行的颜色。
Chase Color - 白色在颜色上运行。
Chase Random - 白色运行,然后是随机颜色。
Chase Rainbow - 白色在彩虹上奔跑。
Chase Flash - 白色闪烁彩色。
Chase Flash Random - 白色闪烁,然后是随机颜色。
Chase Rainbow White - 运行在白色的彩虹。
Chase Blackout - 黑色在彩色上运行。
Chase Blackout Rainbow - 黑色在彩虹上奔跑。
随机颜色扫描- 从条带的开始和结束交替引入随机颜色。
运行颜色- 交替运行的颜色/白色像素。
Running Red Blue - 交替运行红色/蓝色像素。
随机运行- 随机彩色像素运行。
Larson 扫描仪- KITT
Comet - 从一端发射彗星。
烟花- 烟花火花。
Fireworks Random - 随机彩色烟花火花。
圣诞快乐- 交替运行绿色/红色像素。
火焰闪烁- 火焰闪烁效果。就像在狂风中。
Fire Flicker (soft) - 火焰闪烁效果。跑得更慢/更软。
Fire Flicker (intense) - 火焰闪烁效果。颜色范围更广。
Circus Combustus - 交替运行的白色/红色/黑色像素。
万圣节- 交替运行橙色/紫色像素。
双色追逐- 两个 LED 在背景色上运行。
三色追逐- 交替运行三个彩色像素。
TwinkleFOX - 灯光随机淡入淡出。
通过 63.自定义- 最多八个用户创建的自定义效果。

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
【有奖直播】2025是德科技数字月-数字新品来助阵
直播时间:3月19日(周三)14:00
直播奖励:小米口红充电宝、倍思充电线、是德科技十周年鼠标垫

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表