#include <Adafruit_NeoPixel.h>

#define PIN 9
#define LED_NUM 16
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_NUM, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
strip.begin();
}

uint32_t R =0;
uint32_t G =0;
uint32_t B =0;
uint32_t color;
int bright =0;
void loop() {
uint32_t color = strip.Color(R, G, B);
int i;
for (i=0;i<LED_NUM;i++)
{
    strip.setPixelColor(i,color);
}
if (R>=255)
{
    bright=1;
}
else if (R<=0)
{
    bright=0;
}
strip.show();
delay(20);
if (bright==0)
{
    delay(100);
    R++;
    G++;
    B++;
}
else
{
    R--;
    G--;
    B--;
}
}

相关文章:

  • 2022-01-01
  • 2021-05-19
  • 2022-01-01
  • 2021-08-01
  • 2022-12-23
  • 2021-05-11
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2022-01-01
  • 2021-12-24
  • 2021-11-27
  • 2022-01-01
相关资源
相似解决方案