Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <AlaLedRgb.h>
AlaLedRgb rgbStripChill;
AlaLedRgb rgbStripBurn;
AlaLedRgb rgbStripoff;
AlaSeq Burn[] =
{
{ ALA_OFF, 100, 100, alaPalNull },
{ ALA_FIRE, 1000, 6000, alaPalFire },
{ ALA_OFF, 100, 100, alaPalNull },
{ ALA_ENDSEQ }
};
AlaSeq Chill[] =
{
{ ALA_OFF, 100, 100, alaPalNull },
{ ALA_SPARKLE2, 1000, 6000, alaPalCool },
{ ALA_OFF, 100, 100, alaPalNull },
{ ALA_ENDSEQ }
};
AlaSeq off[] =
{
{ ALA_OFF, 100, 100, alaPalNull },
{ ALA_ENDSEQ }
};
int buttonState;
int toggleState;
void setup()
{
Serial.begin(9600);
pinMode(3, INPUT);
pinMode(6, OUTPUT);
rgbStripBurn.initWS2812(5, 12);
rgbStripBurn.setBrightness(0x444444);
rgbStripBurn.setAnimation(Burn);
rgbStripChill.initWS2812(5, 12);
rgbStripChill.setBrightness(0x111111);
rgbStripChill.setAnimation(Chill);
rgbStripoff.initWS2812(5, 12);
rgbStripoff.setBrightness(0x000000);
rgbStripoff.setAnimation(off);
}
void loop()
{
buttonState = digitalRead(3);
toggleState = digitalRead(2);
Serial.print("button ");
Serial.println(buttonState);
Serial.print("toggle ");
Serial.println(toggleState);
if (toggleState == HIGH && buttonState == HIGH)
{digitalWrite(6, HIGH);
rgbStripBurn.runAnimation();
}
else if (toggleState == HIGH && buttonState == LOW)
{digitalWrite(6, LOW);
rgbStripChill.runAnimation();
}
else
{ Serial.print("off");
rgbStripoff.runAnimation();}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment