Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //2 DNA spiral
- //16x16 rgb led matrix demo
- //Yaroslaw Turbin 31.07.2020
- //https://vk.com/ldirko
- //https://www.reddit.com/user/ldirko/
- //https://www.reddit.com/r/FastLED/comments/gogs4n/i_made_7x11_matrix_for_my_ntp_clock_project_then/
- #include "FastLED.h"
- // Matrix size
- #define NUM_ROWS 16
- #define NUM_COLS 16
- // LEDs pin
- #define DATA_PIN 3
- // LED brightness
- #define BRIGHTNESS 255
- #define NUM_LEDS NUM_ROWS * NUM_COLS
- // Define the array of leds
- CRGB leds[NUM_LEDS];
- #define mn 255/(NUM_COLS*2)
- #define speeds 30
- #define freq 10
- void setup() {
- FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- }
- void loop() {
- fadeToBlackBy(leds, NUM_LEDS, 100);
- for (int i = 0; i < NUM_ROWS; i++)
- {
- uint16_t ms = millis();
- leds [i * NUM_COLS + beatsin8(speeds, 0, NUM_COLS-1, 0, i * freq)] += CHSV( ms / 29+i*255/(NUM_ROWS-1), 255, beatsin8(speeds, 30, BRIGHTNESS, 0, i * mn+64));
- leds [i * NUM_COLS + beatsin8(speeds, 0, NUM_COLS-1, 0, 128 + i * freq)] += CHSV( ms / 29+i*255/(NUM_ROWS-1)+128, 255, beatsin8(speeds, 30, BRIGHTNESS, 0, i * mn + 128+64));
- }
- blur2d( leds, NUM_COLS, NUM_ROWS, 64);
- FastLED.delay(1);
- }
- uint16_t XY (uint8_t x, uint8_t y) { return (y * NUM_COLS + x);}
Add Comment
Please, Sign In to add comment