APA102 – modrý maják

Blikající efekt ala “ modrý maják“ . Střídavé zesílení a zeslabení svítivosti (alfy).

 

/* This example shows how to make an LED pattern with a large
 * dynamic range using the the extra 5-bit brightness register in
 * the APA102.
 *
 * It sets every LED on the strip to white, with the dimmest
 * possible white at the input end of the strip and the brightest
 * possible white at the other end, and a smooth logarithmic
 * gradient between them.
 *
 * The dimmest possible white is achieved by setting the red,
 * green, and blue color channels to 1, and setting the
 * brightness register to 1.  The brightest possibe white is
 * achieved by setting the color channels to 255 and setting the
 * brightness register to 31.
 */

/* By default, the APA102 library uses pinMode and digitalWrite
 * to write to the LEDs, which works on all Arduino-compatible
 * boards but might be slow.  If you have a board supported by
 * the FastGPIO library and want faster LED updates, then install
 * the FastGPIO library and uncomment the next two lines: */
// #include <FastGPIO.h>
// #define APA102_USE_FAST_GPIO

#include <APA102.h>

// Define which pins to use.
const uint8_t dataPin = 11;
const uint8_t clockPin = 12;
APA102<dataPin, clockPin> ledStrip;

// ledCount = počet LED na pásku
const uint16_t ledCount = 30;
rgb_color colors[ledCount];


void setup()
{


  
}



void loop()
{
  
int Red = 0;
int Green = 0;
int Blue = 255;
int Alfa = 1;



for(Alfa = 0; Alfa <= 31; Alfa++){

  //zahájení posílání
  ledStrip.startFrame();
    for(uint16_t i = 0; i < ledCount; i++)
    {
      // poslat barvu na jednu LED:  Červená(0-255), Zelená(0-255), Modrá(0-255), Intenzita svitu (0-31)
      ledStrip.sendColor(Red, Green, Blue, Alfa);
    }

 
   //ukončení posílání
   ledStrip.endFrame(ledCount);

   delay(5);
}

for(Alfa = 31; Alfa >= 0; Alfa--){

  //zahájení posílání
  ledStrip.startFrame();
    for(uint16_t i = 0; i < ledCount; i++)
    {
      // poslat barvu na jednu LED:  Červená(0-255), Zelená(0-255), Modrá(0-255), Intenzita svitu (0-31)
      ledStrip.sendColor(Red, Green, Blue, Alfa);
    }

 
   //ukončení posílání
   ledStrip.endFrame(ledCount);

   delay(5);
}






}

 

Pro oranžovou barvu:

int Red = 200;
int Green = 30;
int Blue = 0;

 

VIDEO:

https://photos.app.goo.gl/V0SvlpDD2TyHkVBk2

 

 

 

Napsat komentář