HI... ich wollte gerne hier Hilfe finden .. denke nicht dass der Typ im Video mir da weiterhilft..
So schaut der Code aus.. ist unverändert wie aus dem Video. Meine LED Streifen sind die WS2812B die muss man dann in den Scatch einbauen bei
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, NUM_LEDS);
// HAZI TECH
// Program by Hasitha Jayasundara
// Subscribe to my YouTube Channel - http://www.youtube.com/c/HAZITECH?sub_confirmation=1
#include "Arduino.h"
#include <FastLED.h>
#define LED_PIN 1 //LED Strip Signal Connection
#define buttonPin 0 //Push Button Pin
#define NUM_LEDS 50 //Total no of LEDs in the LED strip.
CRGB leds[NUM_LEDS];
int LED_POWER_7 = 255;
int LED_POWER_6 = 255;
int LED_POWER_5 = 150;
int LED_POWER_4 = 100;
int LED_POWER_3 = 50;
int LED_POWER_2 = 20;
int LED_POWER_1 = 5;
int LED_POWER_0 = 0;
int SPEED1 = 75;
int SPEED2 = 30;
int SPEED3 = 400;
int SPEED4 = 60;
int SPEED5 = 300;
int numb=1;
int pres=0;
void setup()
{
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, NUM_LEDS);
FastLED.clear();
pinMode(buttonPin, INPUT_PULLUP);
}
void loop()
{
ButtonScan();
switch (numb) {
case 1:
Pattern1();
break;
case 2:
Pattern2();
break;
case 3:
Pattern3();
break;
case 4:
Pattern4();
break;
case 5:
Pattern5();
break;
case 6:
Pattern6();
break;
case 7:
Pattern7();
break;
case 8:
Pattern8();
break;
case 9:
Pattern9();
break;
case 10:
Pattern10();
break;
case 11:
Pattern11();
break;
case 12:
Pattern12();
break;
case 13:
Pattern13();
break;
default:
Pattern1();
break;
}
}
void Pattern1()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}
void Pattern2()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 0, 0);
}
FastLED.show();
}
void Pattern3()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 255, 0);
}
FastLED.show();
}
void Pattern4()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 255);
}
FastLED.show();
}
void Pattern5()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 255, 255);
}
FastLED.show();
}
void Pattern6()
{
fadeToBlackBy(leds, NUM_LEDS, 10);
int pos = beatsin16(25, 0, NUM_LEDS-1 );
leds[pos] += CRGB(255, 0, 0);
FastLED.show();
FastLED.delay(5);
}
void Pattern7()
{
fadeToBlackBy(leds, NUM_LEDS, 10);
int pos = beatsin16(25, 0, NUM_LEDS-1 );
leds[pos] += CRGB(0, 255, 0);
FastLED.show();
FastLED.delay(5);
}
void Pattern8()
{
fadeToBlackBy(leds, NUM_LEDS, 10);
int pos = beatsin16(25, 0, NUM_LEDS-1 );
leds[pos] += CRGB(0, 0, 255);
FastLED.show();
FastLED.delay(5);
}
void Pattern9()
{
fadeToBlackBy(leds, NUM_LEDS, 10);
int pos = beatsin16(25, 0, NUM_LEDS-1 );
leds[pos] += CRGB(255, 255, 255);
FastLED.show();
FastLED.delay(5);
}
void Pattern10()
{
for (int i = 0; i < 3; i++)
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 0, 0);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
}
delay (SPEED5);
}
void Pattern11()
{
for (int i = 0; i < 3; i++)
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 255, 0);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
}
delay (SPEED5);
}
void Pattern12()
{
for (int i = 0; i < 3; i++)
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 255);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
}
delay (SPEED5);
}
void Pattern13()
{
for (int i = 0; i < 3; i++)
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 255, 255);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show(); ButtonScan();
delay (SPEED4);
}
delay (SPEED5);
}
void ButtonScan()
{
if(digitalRead(buttonPin)==0)
{
if(pres==0)
{
numb++;
pres=1;
}
}
else
{
pres=0;
}
if(numb == 14)
{
numb = 1;
}
}