Natuurlijk, sketch is in principe nog hetzelfde, zijn vele kleine testjes wat ik doe en zoek naar effecten.
Je ziet bijvoorbeeld 2 x een runfire, dit is om de verticale strippen op de diamant iets anders te laten gloeien ten op zichte van elkaar, anders zouden beide strippen exact hetzelfde doen, door ze apart te sturen krijgt het meer een vuur effect maar dat is even om te testen/spelen
de code tot nu toe
// gaat hier om type leonardo arduino
#include "FastLED.h"
const int ledPin4 = 4;// pin nummer voor breakdance leds1
const int ledPin5 = 5;// pin nummer voor breakdance leds2
int ledState4 = LOW;
int ledState5 = LOW;
unsigned long previousMillis = 0;
const long interval = 1500;
unsigned long myTime;
// #define COLOR_ORDER BGR
#define PIN_STRIP1 6 //dit is strip 1 op de diamant
#define PIN_STRIP2 7 //dit is strip 2 op de diamant
#define PIN_STRIP3 8 //dit zijn de leds onder de kop
#define PIN_STRIP4 9 //dit zijn de leds op de kop
#define LED_COUNT1 26 //aantal leds op de diamant in strip 1
#define LED_COUNT2 26 //aantal leds op de diamant in strip 2
#define LED_COUNT3 10 //aantal leds onder de kop
#define LED_COUNT4 31 //aantal leds op de kop
#define LED_TYPE NEOPIXEL
#define NUM_LEDS 28
CRGBPalette16 firePalette = HeatColors_p;
CRGB leds_strip1[LED_COUNT1];
CRGB leds_strip2[LED_COUNT2];
CRGB leds_strip3[LED_COUNT3];
CRGB leds_strip4[LED_COUNT4];
unsigned long currentMillis = 0;
unsigned long startMillis = 0;
void setup() {
FastLED.addLeds<LED_TYPE, PIN_STRIP1>(leds_strip1, LED_COUNT1).setCorrection(TypicalLEDStrip);
FastLED.addLeds<LED_TYPE, PIN_STRIP2>(leds_strip2, LED_COUNT2).setCorrection(TypicalLEDStrip);
FastLED.addLeds<LED_TYPE, PIN_STRIP3>(leds_strip3, LED_COUNT3).setCorrection(TypicalLEDStrip);
FastLED.addLeds<LED_TYPE, PIN_STRIP4>(leds_strip4, LED_COUNT4).setCorrection(TypicalLEDStrip);
FastLED.clear(true); // clear alle LEDs
startMillis = millis(); //start de tijd
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
FastLED.setBrightness(50);
// leds_strip1.setBrightness(25);
// leds_strip2.setBrightness(25);
// leds_strip3.setBrightness(25);
// leds_strip4.setBrightness(25);
}
void Sparkle(CRGB ledstrip[], int ledcount, byte red, byte green, byte blue, int SpeedDelay) {
int Pixel = random(ledcount);
ledstrip[Pixel] = CRGB(red, green, blue);
FastLED.show();
delay(70);
ledstrip[Pixel] = CRGB(0, 0, 0);
}
void runFire1() {
int a = millis();
for (int i = 0; i < NUM_LEDS; i++) {
uint8_t noise = inoise8 (0 , i * 70 - a , a / 3);
uint8_t math = abs8(i - (NUM_LEDS - 26)) * 255 / (NUM_LEDS - 0);
uint8_t index = qsub8 (noise, math);
leds_strip1[i] = ColorFromPalette (firePalette, index, 255);
}
}
void runFire2() {
int a = millis();
for (int i = 0; i < NUM_LEDS; i++) {
uint8_t noise = inoise8 (0 , i * 30 - a , a / 3);
uint8_t math = abs8(i - (NUM_LEDS - 26)) * 255 / (NUM_LEDS - 0);
uint8_t index = qsub8 (noise, math);
leds_strip2[i] = ColorFromPalette (firePalette, index, 255);
}
}
void redWhiteBlue1() {
uint16_t sinBeat = beatsin16(30, 0, LED_COUNT1 - 1, 0, 0);
uint16_t sinBeat2 = beatsin16(30, 0, LED_COUNT1 - 1, 0, 21845);
uint16_t sinBeat3 = beatsin16(30, 0, LED_COUNT1 - 1, 0, 43690);
leds_strip1[sinBeat] = CRGB::Blue;
leds_strip1[sinBeat2] = CRGB::Red;
leds_strip1[sinBeat3] = CRGB::White;
fadeToBlackBy(leds_strip1, LED_COUNT1, 5);
}
void redWhiteBlue2() {
uint16_t sinBeat = beatsin16(60, 0, LED_COUNT2 - 1, 0, 0);
uint16_t sinBeat2 = beatsin16(60, 0, LED_COUNT2 - 1, 0, 21845);
uint16_t sinBeat3 = beatsin16(60, 0, LED_COUNT2 - 1, 0, 43690);
leds_strip2[sinBeat] = CRGB::Blue;
leds_strip2[sinBeat2] = CRGB::Red;
leds_strip2[sinBeat3] = CRGB::White;
fadeToBlackBy(leds_strip2, LED_COUNT2, 5);
}
void loop()
{
currentMillis = millis(); // haal de tijd op
if ( currentMillis - startMillis > 0 && currentMillis - startMillis < 10000)
{
Sparkle(leds_strip1, LED_COUNT1, 0xff, 0xff, 0xff, 180);
Sparkle(leds_strip2, LED_COUNT2, 0xff, 0xff, 0xff, 0);
Sparkle(leds_strip3, LED_COUNT3, 0xff, 0xff, 0xff, 0);
Sparkle(leds_strip4, LED_COUNT4, 0xff, 0xff, 0xff, 0);
}
if ( currentMillis - startMillis > 10000 && currentMillis - startMillis < 20000)
{
EVERY_N_MILLISECONDS(40) {
runFire1();
runFire2();
FastLED.show();
}
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 255, 0)); //Let op NEO_GRB
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (ledState4 == LOW) {
ledState4 = HIGH;
} else {
ledState4 = LOW;
}
digitalWrite(ledPin4, ledState4);
}
if (ledState4 == LOW) {
digitalWrite (ledPin5, HIGH);
} else {
digitalWrite (ledPin5, LOW);
}
}
if ( currentMillis - startMillis > 20000 && currentMillis - startMillis < 30000)
{
// fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 0, 255)); //Let op NEO_GRB
redWhiteBlue1();
redWhiteBlue2();
FastLED.show();
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= 500) {
previousMillis = currentMillis;
if (ledState4 == LOW) {
ledState4 = HIGH;
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 255, 0)); //Let op NEO_GRB
} else {
ledState4 = LOW;
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 0, 255)); //Let op NEO_GRB
}
digitalWrite(ledPin4, ledState4);
}
if (ledState4 == LOW) {
digitalWrite (ledPin5, HIGH);
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 255, 0)); //Let op NEO_GRB
fill_solid( leds_strip4, LED_COUNT4, CRGB(0, 0, 255)); //Let op NEO_GRB
} else {
digitalWrite (ledPin5, LOW);
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 0, 255)); //Let op NEO_GRB
fill_solid( leds_strip4, LED_COUNT4, CRGB(0, 255, 0)); //Let op NEO_GRB
}
}
if ( currentMillis - startMillis > 30000 && currentMillis - startMillis < 32000)
{
fill_solid( leds_strip1, LED_COUNT1, CRGB(255, 0, 0)); //Let op NEO_GRB
fill_solid( leds_strip2, LED_COUNT2, CRGB(255, 0, 0)); //Let op NEO_GRB
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 255, 0)); //Let op NEO_GRB
fill_solid( leds_strip4, LED_COUNT4, CRGB(0, 255, 0)); //Let op NEO_GRB
FastLED.show();
}
if ( currentMillis - startMillis > 32000 && currentMillis - startMillis < 34000)
{
fill_solid( leds_strip1, LED_COUNT1, CRGB(0, 0, 255)); //Let op NEO_GRB
fill_solid( leds_strip2, LED_COUNT2, CRGB(0, 0, 255)); //Let op NEO_GRB
fill_solid( leds_strip3, LED_COUNT3, CRGB(0, 0, 255)); //Let op NEO_GRB
fill_solid( leds_strip4, LED_COUNT4, CRGB(0, 0, 255)); //Let op NEO_GRB
FastLED.show();
}
if ( currentMillis - startMillis > 34000 && currentMillis - startMillis < 36000)
{
fill_solid( leds_strip1, LED_COUNT1, CRGB(0, 255, 0)); //Let op NEO_GRB
fill_solid( leds_strip2, LED_COUNT2, CRGB(0, 255, 0)); //Let op NEO_GRB
fill_solid( leds_strip3, LED_COUNT3, CRGB(255, 0, 0)); //Let op NEO_GRB
fill_solid( leds_strip4, LED_COUNT4, CRGB(255, 0, 0)); //Let op NEO_GRB
FastLED.show();
}
if ( currentMillis - startMillis > 36000 && currentMillis - startMillis < 50000)
{
fill_solid( leds_strip1, LED_COUNT1, CRGB(0, 0, 255)); //Let op NEO_GRB
fill_solid( leds_strip2, LED_COUNT2, CRGB(0, 0, 255)); //Let op NEO_GRB
fill_solid( leds_strip3, LED_COUNT3, CRGB(255, 255, 255)); //Let op NEO_GRB
fill_solid( leds_strip4, LED_COUNT4, CRGB(0, 255, 0)); //Let op NEO_GRB
FastLED.show();
}
}