|
|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
#include <FastLED.h>
|
|
|
|
|
#include <Button.h>
|
|
|
|
|
|
|
|
|
|
// How many leds in your strip?
|
|
|
|
|
#define BRIGHTNESS 96
|
|
|
|
|
#define NUM_LEDS 12
|
|
|
|
|
#define TEMPO 100
|
|
|
|
|
|
|
|
|
|
#define DATA_PIN 0
|
|
|
|
|
#define DATA_PIN 0 // led pin
|
|
|
|
|
#define BTN_PIN 3 // button pin
|
|
|
|
|
|
|
|
|
|
CRGB leds[NUM_LEDS];
|
|
|
|
|
float tcount = 0.0; //-INC VAR FOR SIN LOOPS
|
|
|
|
|
@ -13,7 +15,11 @@ int ibright = 0; //-BRIGHTNESS (0-255)
|
|
|
|
|
int tempo_anim = TEMPO;
|
|
|
|
|
uint8_t gHue = 0; // rotating "base color"
|
|
|
|
|
|
|
|
|
|
void colorWipe_up (struct CRGB rgb, uint8_t wait) {
|
|
|
|
|
Button button1(BTN_PIN, PULLUP, 5000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void colorWipe_up(struct CRGB rgb, uint8_t wait)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < NUM_LEDS; i++) {
|
|
|
|
|
leds[i] = rgb;
|
|
|
|
|
@ -21,7 +27,9 @@ void colorWipe_up (struct CRGB rgb, uint8_t wait) {
|
|
|
|
|
delay(wait);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void colorWipe_down (struct CRGB rgb, uint8_t wait) {
|
|
|
|
|
|
|
|
|
|
void colorWipe_down(struct CRGB rgb, uint8_t wait)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
for (int i = NUM_LEDS - 1; i >= 0; i--) {
|
|
|
|
|
leds[i] = rgb;
|
|
|
|
|
@ -29,12 +37,16 @@ void colorWipe_down (struct CRGB rgb, uint8_t wait) {
|
|
|
|
|
delay(wait);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void black_out(){
|
|
|
|
|
|
|
|
|
|
void black_out()
|
|
|
|
|
{
|
|
|
|
|
// all leds off
|
|
|
|
|
memset(leds, 0, NUM_LEDS * 3); // all leds off
|
|
|
|
|
FastSPI_LED.show();
|
|
|
|
|
}
|
|
|
|
|
void dual_color(struct CRGB color1, struct CRGB color2,uint8_t wait) {
|
|
|
|
|
|
|
|
|
|
void dual_color(struct CRGB color1, struct CRGB color2, uint8_t wait)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < NUM_LEDS; i++) {
|
|
|
|
|
memset(leds, 0, NUM_LEDS * 3); // all leds off
|
|
|
|
|
leds[i] = color1;
|
|
|
|
|
@ -44,32 +56,37 @@ void dual_color(struct CRGB color1, struct CRGB color2,uint8_t wait) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
|
{
|
|
|
|
|
// put your setup code here, to run once:
|
|
|
|
|
FastLED.addLeds < WS2812B, DATA_PIN, GRB > (leds, NUM_LEDS);
|
|
|
|
|
FastLED.setBrightness(BRIGHTNESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
void loop()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// put your main code here, to run repeatedly:
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
|
colorWipe_up(CRGB::Red, tempo_anim);
|
|
|
|
|
delay(100);
|
|
|
|
|
colorWipe_down ( CRGB::Green,tempo_anim);
|
|
|
|
|
delay(100);
|
|
|
|
|
colorWipe_up ( CRGB::Purple,tempo_anim);
|
|
|
|
|
delay(100);
|
|
|
|
|
colorWipe_down ( CRGB::Blue,tempo_anim);
|
|
|
|
|
delay(100);
|
|
|
|
|
colorWipe_up ( CRGB::Black,tempo_anim);
|
|
|
|
|
delay(100);
|
|
|
|
|
colorWipe_up(CRGB::Green, tempo_anim);
|
|
|
|
|
delay(tempo_anim);
|
|
|
|
|
}
|
|
|
|
|
//dual_color( CRGB::LightGreen,CRGB::Aqua,tempo_anim);
|
|
|
|
|
// dual_color( CRGB::Aqua,CRGB::LightGreen,tempo_anim);
|
|
|
|
|
dual_color( CRGB::AliceBlue,CRGB::OrangeRed,tempo_anim);
|
|
|
|
|
dual_color( CRGB::AliceBlue,CRGB::OrangeRed,tempo_anim);
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
|
dual_color(CRGB::Red, CRGB::Green, tempo_anim);
|
|
|
|
|
// dual_color( CRGB::Green,CRGB::Red,tempo_anim);
|
|
|
|
|
}
|
|
|
|
|
black_out();
|
|
|
|
|
delay(100);
|
|
|
|
|
delay(tempo_anim);
|
|
|
|
|
|
|
|
|
|
if (button1.checkPress() == 1) {
|
|
|
|
|
void (); // Serial.println("SHORT PRESS!");
|
|
|
|
|
} else if (button1.checkPress() == -1) {
|
|
|
|
|
void (); // Serial.println("LONG PRESS!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|