Hey, i am not very good at coding and trying to learn as much as i could. I am thinking about creating a homemade party light, in the past i have made different codes for different light effects and combined them in a loop making them play all over without eny sort of controlling the modes. Therefor i want to include a button to be able to switch between different modes on this light. Do anyone have any tips to make it so that each press of a button changes the mode from one effect to another? Heres a part of my existing code of effects:
#include <Adafruit_NeoPixel.h>
#define PIN1 7
#define N_LEDS1 24
#define NUM_LIT 50
#define SPEED 0.1
#define BRIGHTNESS 225
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(N_LEDS1, PIN1, NEO_RGB + NEO_KHZ800);
void setup() {
strip1.begin();
strip1.show();
}
void loop() {
Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
chase(strip1.Color(BRIGHTNESS, BRIGHTNESS, 0)); //
// chase(strip1.Color(0, BRIGHTNESS, BRIGHTNESS)); //
// chase(strip1.Color(0, BRIGHTNESS, 0)); // Green
chase_back(strip1.Color(BRIGHTNESS, 0, 0)); // Red
// chase(strip1.Color(0, 0, BRIGHTNESS)); // Blue
Thanks for any help!