登录 注册
当前位置:主页 > 资源下载 > 46 > WS2812FX-master.zip下载

WS2812FX-master.zip下载

  • 更新:2024-11-04 16:46:32
  • 大小:887KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:其它 - 移动开发
  • 格式:ZIP

资源介绍

WS2812控制LED灯程序库 #include "FastLED.h" // be sure to install and include the FastLED lib #include #define NUM_LEDS 30 #define LED_PIN 5 WS2812FX ws2812fx = WS2812FX(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800); // declare global parameters used by Fire2012 bool gReverseDirection = false; void setup() { Serial.begin(115200); // init WS2812FX to use a custom effect ws2812fx.init(); ws2812fx.setBrightness(255); ws2812fx.setColor(BLUE); ws2812fx.setSpeed(1000); ws2812fx.setMode(FX_MODE_CUSTOM); ws2812fx.setCustomMode(myCustomEffect); ws2812fx.start(); } void loop() { ws2812fx.service(); } // in the custom effect run the Fire2012 algorithm uint16_t myCustomEffect() { Fire2012(); // return the animation speed based on the ws2812fx speed setting return (ws2812fx.getSpeed() / NUM_LEDS); }