Code to change between 4 animations and one static light
Copy below (code will only show on desktop version):
// Just copy all the code from here...
#include
#ifdef __AVR__
#include <avr/power.h>
#endif
// button/switch pins
#define BUTTON_PIN 3
#define BUTTON_PIN 4
// LED strip pins
#define PIXEL_PIN 6
#define PIXEL_PIN2 5
// number of LEDs (on strip)
#define PIXEL_COUNT 30
#define PIXEL_COUNT2 30
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(PIXEL_COUNT2, PIXEL_PIN2, NEO_GRB + NEO_KHZ800);
const int buttonPin = 3; // the number of the pushbutton pin
int buttonState = 0; // variable for reading the pushbutton status
const int buttonPin2 = 4; // the number of the pushbutton pin
int buttonState2 = 0; // variable for reading the pushbutton status
void setup()
{
strip.begin();
strip.show();
strip2.begin();
// strip2 is constantly on
for(uint16_t i = 0; i < strip2.numPixels(); i++) {
strip2.setPixelColor(i, 255, 255, 255); // white light, change color by changing numbers
}
strip2.show();
pinMode(buttonPin, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(buttonPin);
buttonState2 = digitalRead(buttonPin2);
if (buttonState == HIGH)
{
if (buttonState2 == HIGH)
// animation 1
else
// animation 2
}
else
{
if (buttonState2 == HIGH)
// animation 3
else
// animation 4
}
}
void animation 1 {}
void animation 2 {}
void animation 3 {}
void animation 4 {}
// ... to here!