/*
PAB49162 Wokwi projets
https://wokwi.com/makers/pab49162
WLED multi-strip support
https://kno.wled.ge/features/multi-strip/
Multiple controller examples
https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples
Strip effects for NeoPixel and FastLED
https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/
RGB color code chart
https://www.rapidtables.com/web/color/RGB_Color.html
NeoMatrix setup guide
https://learn.adafruit.com/adafruit-neopixel-uberguide/neomatrix-library
Microphone INMP441 I2S Omnidirectional Module
https://techmaze.romman.store/product/99189039$0
*/
#include "FastLED.h"
#include <Adafruit_NeoPixel.h>
#define NUM_LEDS 48
CRGB leds[NUM_LEDS];
#define PIN 12
void setup()
{
Serial.begin(9600);
FastLED.addLeds<WS2812, PIN, RGB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}
void loop() {
Sparkle(0xff, 0xff, 0xff, 100);
}
void Sparkle(byte red, byte green, byte blue, int SpeedDelay) {
int Pixel = random(NUM_LEDS);
Serial.print("Pixel value is ");
Serial.println(Pixel);
setPixel(Pixel,red,green,blue);
showStrip();
delay(SpeedDelay);
setPixel(Pixel,0,0,0);
}
void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
// FastLED
FastLED.show();
#endif
}
void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
// FastLED
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
#endif
}
void setAll(byte red, byte green, byte blue) {
for(int i = 0; i < NUM_LEDS; i++ ) {
setPixel(i, red, green, blue);
}
showStrip();
}