11447| 8
|
[进阶] 用8x8的LED点阵屏来一段酷炫的灯效 |
今天收到了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里。 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed