8x8 WS2812b Colourful Soft Starry Sky Effect

by wilsnico in Circuits > Arduino

20 Views, 0 Favorites, 0 Comments

8x8 WS2812b Colourful Soft Starry Sky Effect

FRG0MBJM6M7DVW6.png

Colourful soft Starry Sky Effect for 8x8 matrix.

Supplies

Resistor

Arduino

Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix

Or another WS2812B 8x8 matrix .

Info

Colourful soft Starry Sky Effect for 8x8 matrix.

Code is in void and void is called in loop.

Connection Resistor to Matrix on PIN 5.

Code

#include "Adafruit_NeoPixel.h"
#define WS2812b_PIN 5
#define WS2812b_PIXELS 64
#define WS2812b_WIDTH 8
#define WS2812b_HEIGHT 8
Adafruit_NeoPixel WS2812b = Adafruit_NeoPixel(WS2812b_PIXELS, WS2812b_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
Serial.begin(9600);
WS2812b.begin();
WS2812b.clear();
WS2812b.show();
}

void softStarrySkyEffect() {
static uint8_t hue = 0;
for (int i = 0; i < WS2812b_PIXELS; i++) {
if (random(100) < 5) {
uint32_t color = WS2812b.ColorHSV((hue + random(0, 65536)) % 65536, 255, random(50, 150));
WS2812b.setPixelColor(i, color);
}
else {
WS2812b.setPixelColor(i, 0);
}}
WS2812b.show();
delay(150);
hue = (hue + 1) % 256;
}

void loop() {
softStarrySkyEffect();
}