用8x8的LED点阵屏来一段酷炫的灯效
2019-01-192.3万
AI 快速预览详细
本文介绍了如何使用8x8 LED点阵屏和Arduino UNO,通过FastLED库实现多种酷炫灯效。硬件包括8x8 LED点阵屏、Arduino UNO和几根电线。文中提供了详细的代码示例,展示了如何通过FastLED库实现Twinkle、Snake、Sprite等多种动态灯效。适合初学者和爱好者,可以轻松创建动态灯光效果。
今天收到了8x8的led点阵,很开心。马上来一段测试。看着不错。![]() ![]() 硬件就是上面两个模块和几根电线。主控可以用Arduino的很多板,例如UNO,MEGA2560,LEONARDO,但不能用arduino mini。我用你的是UNO连线是GND-UNO GND,VCC-UNO VCC,DATA-UNO Pin3. [mw_shl_code=applescript,true]#include <FastLED.h> #include "Plasma.cpp" #include "Snake.cpp" #include "Twinkle.cpp" #include "DeadChannel.cpp" #include "Sprite.cpp" #define WIDTH 8 #define HEIGHT 8 #define NUM_LEDS WIDTH * HEIGHT #define DATA_PIN 3 CRGB leds[NUM_LEDS]; void setup() { // put your setup code here, to run once: FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); } void loop() { doTwinkle(); doSnake(); doSprite(); } void doDeadChannel() { DeadChannel deadChannel(leds, WIDTH, HEIGHT); deadChannel.start(); } void doPlasma() { Plasma plasma(leds, WIDTH, HEIGHT); plasma.start(); } void doTwinkle() { Twinkle twinkle(leds, WIDTH, HEIGHT, true, true); twinkle.start(); } void doSnake() { Snake snake(leds, WIDTH, HEIGHT); snake.start(); } void doSprite() { Sprite sprite(leds, WIDTH, HEIGHT); sprite.start(); } [/mw_shl_code] FastLED_master.rar注意:要把我提供的FastLED库解压并放到arduno library里。 |








应该可以。Mind+不是支持C语言吗。