Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Perlin noise plasma procedure
- //16x16 rgb led matrix demo
- //Yaroslaw Turbin
- //https://vk.com/ldirko
- //https://www.reddit.com/user/ldirko/
- //https://www.reddit.com/r/FastLED/comments/h09406/simple_plasma_effect/
- #include "FastLED.h"
- // Matrix size
- #define NUM_ROWS 16
- #define NUM_COLS 16
- #define NUM_LEDS NUM_ROWS * NUM_COLS
- // LEDs pin
- #define DATA_PIN 3
- // LED brightness
- #define BRIGHTNESS 255
- // Define the array of leds
- CRGB leds[NUM_LEDS];
- void setup() {
- FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- }
- void loop() {
- uint16_t ms = millis();
- for (int i = 0; i < NUM_COLS; i++) {
- for (int j = 0; j < NUM_ROWS; j++) {
- uint8_t index = inoise8(i * 41, j * 41, ms / 4); // x and y not change, only change z value with time increment for nice plasma looking noise
- leds[XY (i, j)] = CHSV((index + ms / 200) % 255, 255, BRIGHTNESS); // within palette
- // leds[XY (i, j)] = ColorFromPalette (RainbowColors_p, (index + ms / 200) % 255, BRIGHTNESS ); // with palette
- }
- }
- FastLED.delay(1);
- }
- uint8_t XY (uint8_t x, uint8_t y) { return (y * NUM_COLS + x);} //simple function to find led number in led matrix,
- //change this to your routine
- //or generate XY function for your matrix there:
- //https://macetech.github.io/FastLED-XY-Map-Generator/
Add Comment
Please, Sign In to add comment