/* LC-1X+ code notes:
-poop poop
-pee?
-poo
*/
#include <Arduino.h>
#include <Adafruit_TinyUSB.h>
#include <MIDI.h>
#include <DmxOutput.h>
#include <EEPROM.h>
#include <pico/cyw43_arch.h>
#include "pico/bootrom.h" // For reset_usb_boot function
#include <FastLED.h>
#include <pico/stdlib.h>
// USB MIDI object
Adafruit_USBD_MIDI usb_midi;
// Declare an instance of the DMX Output
DmxOutput dmx;
// Create a universe that we want to send.
// The universe must be maximum 512 bytes + 1 byte of start code
#define UNIVERSE_LENGTH 128
uint8_t universe[UNIVERSE_LENGTH + 1];
//fastled stuff
#define LED_PIN 3
#define NUM_LEDS 150
#define BRIGHTNESS 64
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
bool fastLEDnote[3] = { false, false, false };
int fastLEDvelocity = 0;
//#define UPDATES_PER_SECOND 10
CRGBPalette16 currentPalette;
TBlendType currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p FL_PROGMEM;
void ChangePalettePeriodically();
void FillLEDsFromPaletteColors(uint8_t colorIndex);
void SetupPurpleAndGreenPalette();
void SetupTotallyRandomPalette();
void SetupBlackAndWhiteStripedPalette();
int motion_speed=8;
int REAL_NUM_LEDS=150;
int UPDATES_PER_SECOND = 10;
int red = 2; // PWM red led to pin 2
int grn = 0; // PWM green led to pin 0
int blu = 1; // PWM blue led to pin 1
int ambr = 4; // PWM amber led to pin 4
int wht = 5; // PWM white led to pin 5
int ledPin = PIN_LED; // the number of the LED pin
const int usb_pwr = 24; // the number of the LED pin
const int BOOT_BUTTON = 27; // Example: GPIO pin 0
//button stuff
// this constant won't change:
const int buttonPin = 6; // the pin that the pushbutton is attached to
//DIP switch inputs
const int SW7 = 18;
const int SW6 = 19;
const int SW5 = 20;
const int SW4 = 21;
const int SW3 = 22;
const int SW2 = 26;
const int SW1 = 27;
// Variables will change:
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
bool lastPwrState = true; //previous state of power
bool vbuspwr = false;
int mode = 0; // mode the unit is in
int basenote = 0;
int basech = 0;
int midilearn = 0;
int count = 0;
int dmx_count = 0;
//count vals for shooting star on smartled
int count1 = 2000;
int count2 = 2000;
int count3 = 2000;
int count4 = 2000;
int count5 = 2000;
int count6 = 2000;
//used for experiement delete
unsigned long previousMillis = 0;
const int dmx_array[128] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255 };
// Create a new instance of the Arduino MIDI Library,
// and attach usb_midi as the transport.
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDIuart); // Serial MIDI over MIDI FeatherWing
bool usb_power_connected(void) {
// Pico W uses wifi chip GPIO to detect USB power - pin 2
// return cyw43_arch_gpio_get(CYW43_WL_GPIO_VBUS_PIN);
return cyw43_arch_gpio_get(2);
}
void setup() {
// Manual begin() is required on core without built-in support e.g. mbed rp2040
if (!TinyUSBDevice.isInitialized()) {
TinyUSBDevice.begin(0);
}
//set hardware midi pins
Serial1.setRX(17);
Serial1.setTX(16);
pinMode(usb_pwr, INPUT);
Serial.begin(115200);
// declare pin to be an output:
pinMode(grn, OUTPUT);
pinMode(red, OUTPUT);
pinMode(blu, OUTPUT);
pinMode(ambr, OUTPUT);
pinMode(wht, OUTPUT);
usb_midi.setStringDescriptor("Boomlights LC-1X+");
USBDevice.setManufacturerDescriptor("Boomlights");
USBDevice.setProductDescriptor("LC-1X+");
// Initialize MIDI, and listen to all MIDI channels
// This will also call usb_midi's begin()
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDIuart.begin(MIDI_CHANNEL_OMNI); // don't forget OMNI
// If already enumerated, additional class driverr begin() e.g msc, hid, midi won't take effect until re-enumeration
if (TinyUSBDevice.mounted()) {
TinyUSBDevice.detach();
delay(10);
TinyUSBDevice.attach();
}
if (usb_power_connected()) {
// Attach the handleNoteOn function to the MIDI Library. It will
// be called whenever the Bluefruit receives MIDI Note On messages.
MIDI.setHandleNoteOn(handleNoteOn);
// Do the same for MIDI Note Off messages.
MIDI.setHandleNoteOff(handleNoteOff);
} else {
MIDIuart.setHandleNoteOn(handleNoteOn);
// Do the same for MIDI Note Off messages.
MIDIuart.setHandleNoteOff(handleNoteOff);
}
}
// Running on core1
void setup1() {
//EEPROM stuff
EEPROM.begin(512);
//boot mode switch
pinMode(BOOT_BUTTON, INPUT);
pinMode(BOOT_BUTTON, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
//BUTTON stuff
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
pinMode(buttonPin, INPUT_PULLUP);
//DIP initialize DIP switches as input and anable pullup
pinMode(SW7, INPUT);
pinMode(SW7, INPUT_PULLUP);
pinMode(SW6, INPUT);
pinMode(SW6, INPUT_PULLUP);
pinMode(SW5, INPUT);
pinMode(SW5, INPUT_PULLUP);
pinMode(SW4, INPUT);
pinMode(SW4, INPUT_PULLUP);
pinMode(SW3, INPUT);
pinMode(SW3, INPUT_PULLUP);
pinMode(SW2, INPUT);
pinMode(SW2, INPUT_PULLUP);
pinMode(SW1, INPUT);
pinMode(SW1, INPUT_PULLUP);
//set mode on startup
if (digitalRead(SW5) == HIGH && digitalRead(SW6) == HIGH && digitalRead(SW7) == HIGH) {
mode = 0;
}
if (digitalRead(SW5) == HIGH && digitalRead(SW6) == HIGH && digitalRead(SW7) == LOW) {
mode = 1;
}
if (digitalRead(SW5) == HIGH && digitalRead(SW6) == LOW && digitalRead(SW7) == HIGH) {
mode = 2;
}
if (digitalRead(SW5) == HIGH && digitalRead(SW6) == LOW && digitalRead(SW7) == LOW) {
mode = 3;
}
if (digitalRead(SW5) == LOW && digitalRead(SW6) == HIGH && digitalRead(SW7) == HIGH) {
mode = 4;
}
if (digitalRead(SW5) == LOW && digitalRead(SW6) == HIGH && digitalRead(SW7) == LOW) {
mode = 5;
}
if (digitalRead(SW5) == LOW && digitalRead(SW6) == LOW && digitalRead(SW7) == HIGH) {
mode = 6;
}
if (mode == 6) {
//set up fastled stuff
analogWrite(red, 255);
analogWrite(blu, 255);
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, REAL_NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
currentPalette = RainbowColors_p;
currentBlending = LINEARBLEND;
} else {
//dmx setup stuff
// Start the DMX Output on GPIO-pin 0
dmx.begin(7, pio1);
// Set all channels in the universe to the max allowed value (512)
for (int i = 1; i < UNIVERSE_LENGTH + 1; i++) {
universe[i] = 0;
}
}
}
void loop() {
if (vbuspwr == true) {
#ifdef TINYUSB_NEED_POLLING_TASK
// Manual call tud_task since it isn't called by Core's background
TinyUSBDevice.task();
#endif
// not enumerated()/mounted() yet: nothing to do
if (!TinyUSBDevice.mounted()) {
return;
}
}
// read any new MIDI messages
if (vbuspwr == true) {
MIDI.read();
} else {
MIDIuart.read();
}
}
void loop1() {
if (EEPROM.read(2) == 'M') {
basenote = EEPROM.read(0);
basech = EEPROM.read(1);
} else {
//init default values on program
basenote = 0;
basech = 1;
EEPROM.write(0, basenote);
EEPROM.write(1, basech);
EEPROM.write(2, 'M');
EEPROM.commit();
}
delay(500);
//set unit into MIDI learn mode
if (digitalRead(buttonPin) == LOW) {
midilearn = 1;
analogWrite(grn, 60);
} else {
midilearn = 0;
}
//intro light flash
if (midilearn == 0) {
switch (mode) {
case 0:
//red
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//wht
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 127);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
break;
case 1:
//red
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[10] = 255;
universe[11] = 255;
universe[12] = 0;
universe[13] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
universe[10] = 255;
universe[11] = 0;
universe[12] = 255;
universe[13] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
universe[10] = 255;
universe[11] = 0;
universe[12] = 0;
universe[13] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[10] = 0;
universe[11] = 0;
universe[12] = 0;
universe[13] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
break;
case 2:
//red
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//wht
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 127);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 255;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//amber
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 127);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
break;
case 3:
//red
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//wht
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 127);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 255;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//amber
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 127);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
break;
case 4:
//amber
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 127);
delay(500);
analogWrite(ambr, 0);
delay(500);
analogWrite(ambr, 127);
delay(500);
analogWrite(ambr, 0);
delay(500);
analogWrite(ambr, 127);
delay(500);
analogWrite(ambr, 0);
delay(500);
analogWrite(ambr, 127);
delay(500);
analogWrite(ambr, 0);
delay(500);
analogWrite(ambr, 127);
break;
case 5:
//green
analogWrite(grn, 127);
analogWrite(red, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[20] = 0;
universe[21] = 255;
universe[22] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//red
analogWrite(grn, 0);
analogWrite(red, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[20] = 255;
universe[21] = 0;
universe[22] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//blu
analogWrite(grn, 0);
analogWrite(red, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
universe[20] = 0;
universe[21] = 0;
universe[22] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[20] = 0;
universe[21] = 0;
universe[22] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
delay(500);
break;
}
}
//MAIN LOOP of Loop1
while (1) {
// Example: Check if the boot button is pressed
if (!digitalRead(BOOT_BUTTON)) {
// Enter bootloader mode
reset_usb_boot(0, 0);
}
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == LOW) {
digitalWrite(ledPin, !digitalRead(ledPin));
// Serial.println(basenote);
// Serial.println(basech);
//Serial.println(midilearn);
//Serial.println(mode);
count = count + 1;
//mode 0 button test button
if (mode == 0) {
if (count == 5) {
count = 0;
}
switch (count) {
case 0:
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 1:
//red
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 2:
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 3:
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 4:
//wht
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 127);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
break;
}
}
//mode 1 button test button
if (mode == 1) {
if (count == 4) {
count = 0;
}
switch (count) {
case 0:
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[10] = 0;
universe[11] = 0;
universe[12] = 0;
universe[13] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 1:
//red
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[10] = 255;
universe[11] = 255;
universe[12] = 0;
universe[13] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 2:
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
universe[10] = 255;
universe[11] = 0;
universe[12] = 255;
universe[13] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 3:
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
universe[10] = 255;
universe[11] = 0;
universe[12] = 0;
universe[13] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
break;
}
}
//mode 2 button test button
if (mode == 2) {
if (count == 6) {
count = 0;
}
switch (count) {
case 0:
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 1:
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 2:
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 3:
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(ambr, 0);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 4:
//wht
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 127);
analogWrite(wht, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 255;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 5:
//amber
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(ambr, 0);
analogWrite(wht, 127);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
break;
}
}
//mode 3 button test button
if (mode == 3) {
if (count == 6) {
count = 0;
}
switch (count) {
case 0:
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 1:
analogWrite(red, 127);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 255;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 2:
//grn
analogWrite(red, 0);
analogWrite(grn, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 255;
universe[3] = 0;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 3:
//blu
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 255;
universe[4] = 0;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 4:
//wht
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 127);
analogWrite(ambr, 0);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 255;
universe[5] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 5:
//amber
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
analogWrite(ambr, 127);
universe[1] = 0;
universe[2] = 0;
universe[3] = 0;
universe[4] = 0;
universe[5] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
break;
}
}
//mode 3 button test button
if (mode == 4) {
analogWrite(ambr, 0);
delay(200);
analogWrite(ambr, 127);
if (count == 2) {
count = 0;
}
if (count == 0) {
for (int i = 0; i < 128; i++) {
universe[i] = 0;
}
}
if (count == 1) {
for (int i = 0; i < 128; i++) {
universe[i] = 255;
}
}
dmx.write(universe, UNIVERSE_LENGTH);
}
//mode 5 button test button
if (mode == 5) {
if (count == 4) {
count = 0;
}
switch (count) {
case 0:
//clear all
analogWrite(red, 0);
analogWrite(grn, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[20] = 0;
universe[21] = 0;
universe[22] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 1:
//green
analogWrite(grn, 127);
analogWrite(red, 0);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[20] = 0;
universe[21] = 255;
universe[22] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 2:
analogWrite(grn, 0);
analogWrite(red, 127);
analogWrite(blu, 0);
analogWrite(wht, 0);
universe[20] = 255;
universe[21] = 0;
universe[22] = 0;
dmx.write(universe, UNIVERSE_LENGTH);
break;
case 3:
//blu
analogWrite(grn, 0);
analogWrite(red, 0);
analogWrite(blu, 127);
analogWrite(wht, 0);
universe[20] = 0;
universe[21] = 0;
universe[22] = 255;
dmx.write(universe, UNIVERSE_LENGTH);
break;
}
}
if (mode == 6) {
if (count == 2) {
count = 0;
}
switch (count) {
case 0:
fastLEDnote[0]=false;
analogWrite(grn, 0);
break;
case 1:
fastLEDnote[0] = true;
analogWrite(grn, 127);
UPDATES_PER_SECOND=25;
//change this to velocity(pattern) value of choice
fastLEDvelocity = 97;
break;
}
}
}
}
// save the current state as the last state, for next time through the loop
lastButtonState = buttonState;
if (mode == 6) {
fastLEDstuff();
} else {
// Send out universe on GPIO-pin 1
dmx.write(universe, UNIVERSE_LENGTH);
while (dmx.busy()) {
/* Do nothing while the DMX frame transmits */
}
// delay a millisecond for stability (Not strictly necessary)
delay(1);
}
if (usb_power_connected()) {
vbuspwr = true;
//reset unit if usb is plugged in
if (lastPwrState == false) {
rp2040.reboot();
}
} else {
vbuspwr = false;
lastPwrState = false;
}
}
}
void handleNoteOn(byte channel, byte pitch, byte velocity) {
//midi learn mode
if (midilearn == 1) {
EEPROM.write(0, pitch);
EEPROM.write(1, channel);
EEPROM.commit();
analogWrite(blu, 127);
delay(500);
analogWrite(blu, 0);
} else {
MIDIuart.sendNoteOn(pitch, velocity, channel);
//turn on LED and DMX with incoming note on command
if (channel == basech) {
switch (mode) {
case 0:
if (pitch == basenote) {
analogWrite(red, velocity);
universe[1] = dmx_array[velocity];
}
if (pitch == basenote + 1) {
analogWrite(grn, velocity);
universe[2] = dmx_array[velocity];
}
if (pitch == basenote + 2) {
analogWrite(blu, velocity);
universe[3] = dmx_array[velocity];
}
if (pitch == basenote + 3) {
analogWrite(wht, velocity);
universe[4] = dmx_array[velocity];
}
break;
case 1:
universe[10]=255;
if (pitch == basenote) {
analogWrite(red, velocity);
universe[1] = dmx_array[velocity];
universe[11] = dmx_array[velocity];
}
if (pitch == basenote + 1) {
analogWrite(grn, velocity);
universe[2] = dmx_array[velocity];
universe[12] = dmx_array[velocity];
}
if (pitch == basenote + 2) {
analogWrite(blu, velocity);
universe[3] = dmx_array[velocity];
universe[13] = dmx_array[velocity];
}
break;
case 2:
if (pitch == basenote) {
analogWrite(red, velocity);
universe[1] = dmx_array[velocity];
}
if (pitch == basenote + 1) {
analogWrite(grn, velocity);
universe[2] = dmx_array[velocity];
}
if (pitch == basenote + 2) {
analogWrite(blu, velocity);
universe[3] = dmx_array[velocity];
}
if (pitch == basenote + 3) {
analogWrite(ambr, velocity);
universe[4] = dmx_array[velocity];
}
if (pitch == basenote + 4) {
analogWrite(wht, velocity);
universe[5] = dmx_array[velocity];
}
break;
case 3:
if (pitch == basenote) {
analogWrite(red, velocity);
universe[1] = dmx_array[velocity];
}
if (pitch == basenote + 1) {
analogWrite(grn, velocity);
universe[2] = dmx_array[velocity];
}
if (pitch == basenote + 2) {
analogWrite(blu, velocity);
universe[3] = dmx_array[velocity];
}
if (pitch == basenote + 3) {
analogWrite(wht, velocity);
universe[4] = dmx_array[velocity];
}
if (pitch == basenote + 4) {
analogWrite(ambr, velocity);
universe[5] = dmx_array[velocity];
}
break;
case 4:
universe[pitch + 1] = velocity;
break;
case 5:
if (pitch == basenote) {
analogWrite(grn, velocity);
universe[21] = dmx_array[velocity];
}
if (pitch == basenote + 1) {
analogWrite(red, velocity);
universe[20] = dmx_array[velocity];
}
if (pitch == basenote + 2) {
analogWrite(blu, velocity);
universe[22] = dmx_array[velocity];
}
case 6:
if (pitch == 0) {
fastLEDnote[0] = true;
analogWrite(grn, 127);
fastLEDvelocity = velocity;
// if(velocity>60){
// currentPalette = myRedWhiteBluePalette_p;
// currentBlending = LINEARBLEND;
// } else{
// //fill_solid(leds, NUM_LEDS, CRGB::Red);
// fill_solid(currentPalette, 16, CRGB::Red);
// currentBlending = NOBLEND;
// }
if (fastLEDnote[0] == true && fastLEDvelocity > 100 && fastLEDvelocity <= 105) {
count1 = 0;
}
if (fastLEDnote[0] == true && fastLEDvelocity > 105 && fastLEDvelocity <= 110) {
count2 = 0;
}
if (fastLEDnote[0] == true && fastLEDvelocity > 110 && fastLEDvelocity <= 115) {
count3 = 0;
}
if (fastLEDnote[0] == true && fastLEDvelocity > 115 && fastLEDvelocity <= 120) {
count4 = 0;
}
if (fastLEDnote[0] == true && fastLEDvelocity > 120 && fastLEDvelocity <= 125) {
count5 = 0;
}
if (fastLEDnote[0] == true && fastLEDvelocity > 125) {
count6 = 0;
}
}
if (pitch == 1) {
fastLEDnote[1] = true;
// fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.setBrightness(dmx_array[velocity]);
}
if (pitch == 2) {
fastLEDnote[2] = true;
UPDATES_PER_SECOND = velocity;
}
//set default vals if no brightness note, or speed note present
if (fastLEDnote[0] == true && fastLEDnote[1] == false) {
FastLED.setBrightness(dmx_array[127]);
}
if (fastLEDnote[0] == true && fastLEDnote[2] == false) {
UPDATES_PER_SECOND = 25;
}
break;
}
}
}
}
void handleNoteOff(byte channel, byte pitch, byte velocity) {
// Log when a note is released.
MIDIuart.sendNoteOff(pitch, velocity, channel);
//turn off LED and DMX with incoming note off note
if (channel == basech) {
switch (mode) {
case 0:
if (pitch == basenote) {
analogWrite(red, 0);
universe[1] = 0;
}
if (pitch == basenote + 1) {
analogWrite(grn, 0);
universe[2] = 0;
}
if (pitch == basenote + 2) {
analogWrite(blu, 0);
universe[3] = 0;
}
if (pitch == basenote + 3) {
analogWrite(wht, 0);
universe[4] = 0;
}
break;
case 1:
if (pitch == basenote) {
analogWrite(red, 0);
universe[1] = 0;
universe[11] = 0;
}
if (pitch == basenote + 1) {
analogWrite(grn, 0);
universe[2] = 0;
universe[12] = 0;
}
if (pitch == basenote + 2) {
analogWrite(blu, 0);
universe[3] = 0;
universe[13] = 0;
}
break;
case 2:
if (pitch == basenote) {
analogWrite(red, 0);
universe[1] = 0;
}
if (pitch == basenote + 1) {
analogWrite(grn, 0);
universe[2] = 0;
}
if (pitch == basenote + 2) {
analogWrite(blu, 0);
universe[3] = 0;
}
if (pitch == basenote + 3) {
analogWrite(ambr, 0);
universe[4] = 0;
}
if (pitch == basenote + 4) {
analogWrite(wht, 0);
universe[5] = 0;
}
break;
case 3:
if (pitch == basenote) {
analogWrite(red, 0);
universe[1] = 0;
}
if (pitch == basenote + 1) {
analogWrite(grn, 0);
universe[2] = 0;
}
if (pitch == basenote + 2) {
analogWrite(blu, 0);
universe[3] = 0;
}
if (pitch == basenote + 3) {
analogWrite(wht, 0);
universe[4] = 0;
}
if (pitch == basenote + 4) {
analogWrite(ambr, 0);
universe[5] = 0;
}
break;
case 4:
universe[pitch + 1] = 0;
break;
case 5:
if (pitch == basenote) {
analogWrite(grn, 0);
universe[21] = 0;
}
if (pitch == basenote + 1) {
analogWrite(red, 0);
universe[20] = 0;
}
if (pitch == basenote + 2) {
analogWrite(blu, 0);
universe[22] = 0;
}
case 6:
if (pitch == 0) {
fastLEDnote[0] = false;
analogWrite(grn, 0);
}
if (pitch == 1) {
fastLEDnote[1] = false;
}
if (pitch == 2) {
fastLEDnote[2] = false;
}
//set default vals if no brightness note, or speed note present
if (fastLEDnote[0] == true && fastLEDnote[1] == false) {
FastLED.setBrightness(dmx_array[127]);
}
if (fastLEDnote[0] == true && fastLEDnote[2] == false) {
UPDATES_PER_SECOND = 25;
}
}
}
}
//fastled stuff
void FillLEDsFromPaletteColors(uint8_t colorIndex) {
uint8_t brightness = 255;
for (int i = 0; i < REAL_NUM_LEDS; ++i) {
leds[i] = ColorFromPalette(currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
}
}
// There are several different palettes of colors demonstrated here.
//
// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
//
// Additionally, you can manually define your own color palettes, or you can write
// code that creates color palettes on the fly. All are shown here.
void ChangePalettePeriodically() {
}
// This function sets up a palette of black and white stripes,
// using code. Since the palette is effectively an array of
// sixteen CRGB colors, the various fill_* functions can be used
// to set them up.
void SetupBlackAndWhiteStripedPalette() {
// 'black out' all 16 palette entries...
fill_solid(currentPalette, 16, CRGB::Black);
// and set every fourth one to white.
currentPalette[0] = CRGB::White;
currentPalette[4] = CRGB::White;
currentPalette[8] = CRGB::White;
currentPalette[12] = CRGB::White;
}
// This function sets up a palette of purple and green stripes.
void SetupPurpleAndGreenPalette() {
CRGB purple = CHSV(HUE_PURPLE, 255, 255);
CRGB green = CHSV(HUE_GREEN, 255, 255);
CRGB black = CRGB::Black;
currentPalette = CRGBPalette16(
green, green, black, black,
purple, purple, black, black,
green, green, black, black,
purple, purple, black, black);
}
// This example shows how to set up a static color palette
// which is stored in PROGMEM (flash), which is almost always more
// plentiful than RAM. A static PROGMEM palette like this
// takes up 64 bytes of flash.
const TProgmemPalette16 myRedWhiteBluePalette_p FL_PROGMEM = {
CRGB::Red,
CRGB::Gray, // 'white' is too bright compared to red and blue
CRGB::Blue,
CRGB::Black,
CRGB::Red,
CRGB::Gray,
CRGB::Blue,
CRGB::Black,
CRGB::Red,
CRGB::Red,
CRGB::Gray,
CRGB::Gray,
CRGB::Blue,
CRGB::Blue,
CRGB::Black,
CRGB::Black
};
void fastLEDstuff() {
static uint8_t startIndex = 0;
startIndex = startIndex + motion_speed; /* motion speed */
// if(fastLEDnote[0]==true){
// FillLEDsFromPaletteColors(startIndex);
// }
if (fastLEDnote[0] == false) {
fill_solid(currentPalette, 16, CRGB::Black);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//solids colors
if (fastLEDnote[0] == true && fastLEDvelocity <= 5) {
fill_solid(currentPalette, 16, CRGB::Red);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
if (fastLEDnote[0] == true && fastLEDvelocity > 5 && fastLEDvelocity <= 10) {
fill_solid(currentPalette, 16, CRGB::Green);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
if (fastLEDnote[0] == true && fastLEDvelocity > 10 && fastLEDvelocity <= 15) {
fill_solid(currentPalette, 16, CRGB::Blue);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
if (fastLEDnote[0] == true && fastLEDvelocity > 15 && fastLEDvelocity <= 20) {
fill_solid(currentPalette, 16, CRGB::Cyan);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
if (fastLEDnote[0] == true && fastLEDvelocity > 20 && fastLEDvelocity <= 25) {
fill_solid(currentPalette, 16, CRGB::Purple);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
if (fastLEDnote[0] == true && fastLEDvelocity > 25 && fastLEDvelocity <= 30) {
fill_solid(currentPalette, 16, CRGB::White);
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//Sparkles
//fire-red and yellow
if (fastLEDnote[0] == true && fastLEDvelocity > 30 && fastLEDvelocity <= 35){
for (int i = 0; i < REAL_NUM_LEDS; i++) {
// Draw twinkling pixels
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(30, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
//this part again for two colors
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(0, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
// Fade LEDs
if (leds[i].r > 0 || leds[i].g > 0 || leds[i].b > 0) { // Check if pixel is lit
leds[i].fadeToBlackBy(50); // Fade pixel to black
}
}
}
//ocean-blue and cyan
if (fastLEDnote[0] == true && fastLEDvelocity > 35 && fastLEDvelocity <= 40){
for (int i = 0; i < REAL_NUM_LEDS; i++) {
// Draw twinkling pixels
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(128, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
//this part again for two colors
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(160, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
// Fade LEDs
if (leds[i].r > 0 || leds[i].g > 0 || leds[i].b > 0) { // Check if pixel is lit
leds[i].fadeToBlackBy(50); // Fade pixel to black
}
}
}
//forest-green and yellowy green
if (fastLEDnote[0] == true && fastLEDvelocity > 40 && fastLEDvelocity <= 45){
for (int i = 0; i < REAL_NUM_LEDS; i++) {
// Draw twinkling pixels
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(96, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
//this part again for two colors
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(70, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
// Fade LEDs
if (leds[i].r > 0 || leds[i].g > 0 || leds[i].b > 0) { // Check if pixel is lit
leds[i].fadeToBlackBy(50); // Fade pixel to black
}
}
}
//fcotton candy- pink and purple
if (fastLEDnote[0] == true && fastLEDvelocity > 45 && fastLEDvelocity <= 50){
for (int i = 0; i < REAL_NUM_LEDS; i++) {
// Draw twinkling pixels
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(224, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
//this part again for two colors
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(192, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
// Fade LEDs
if (leds[i].r > 0 || leds[i].g > 0 || leds[i].b > 0) { // Check if pixel is lit
leds[i].fadeToBlackBy(50); // Fade pixel to black
}
}
}
//Blue
if (fastLEDnote[0] == true && fastLEDvelocity > 50 && fastLEDvelocity <= 55){
for (int i = 0; i < REAL_NUM_LEDS; i++) {
// Draw twinkling pixels
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(160, 255, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
// Fade LEDs
if (leds[i].r > 0 || leds[i].g > 0 || leds[i].b > 0) { // Check if pixel is lit
leds[i].fadeToBlackBy(50); // Fade pixel to black
}
}
}
//white
if (fastLEDnote[0] == true && fastLEDvelocity > 55 && fastLEDvelocity <= 60){
for (int i = 0; i < REAL_NUM_LEDS; i++) {
// Draw twinkling pixels
if (random(20) < 2) { // Chance for pixel to twinkle(the random val)
uint8_t intensity = random(100, 255); // Configure random intensity
CRGB set_color = CHSV(160, 0, intensity); // color, color saturation, intensity
leds[i] = set_color; // Set the pixel color
}
// Fade LEDs
if (leds[i].r > 0 || leds[i].g > 0 || leds[i].b > 0) { // Check if pixel is lit
leds[i].fadeToBlackBy(50); // Fade pixel to black
}
}
}
//bands
//white
if (fastLEDnote[0] == true && fastLEDvelocity > 60 && fastLEDvelocity <= 65){
// 'black out' all 16 palette entries...
fill_solid(currentPalette, 16, CRGB::Black);
// and set every fourth one to white.
currentPalette[0] = CRGB::White;
currentPalette[4] = CRGB::White;
currentPalette[8] = CRGB::White;
currentPalette[12] = CRGB::White;
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//fire red and yellow
if (fastLEDnote[0] == true && fastLEDvelocity > 65 && fastLEDvelocity <= 70){
// 'black out' all 16 palette entries...
fill_solid(currentPalette, 16, CRGB::Black);
// and set every fourth one to white.
currentPalette[0] = CRGB::Red;
currentPalette[4] = CRGB::Yellow;
currentPalette[8] = CRGB::Red;
currentPalette[12] = CRGB::Yellow;
currentBlending = NOBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//blue and cyan
if (fastLEDnote[0] == true && fastLEDvelocity > 70 && fastLEDvelocity <= 75){
currentPalette[0] = CRGB::Blue;
currentPalette[1] = CRGB::Blue;
currentPalette[2] = CRGB::Blue;
currentPalette[3] = CRGB::Blue;
currentPalette[4] = CRGB::Cyan;
currentPalette[5] = CRGB::Cyan;
currentPalette[6] = CRGB::Cyan;
currentPalette[7] = CRGB::Cyan;
currentPalette[8] = CRGB::Blue;
currentPalette[9] = CRGB::Blue;
currentPalette[10] = CRGB::Blue;
currentPalette[11] = CRGB::Blue;
currentPalette[12] = CRGB::Cyan;
currentPalette[13] = CRGB::Cyan;
currentPalette[14] = CRGB::Cyan;
currentPalette[15] = CRGB::Cyan;
currentBlending = LINEARBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//cloud
if (fastLEDnote[0] == true && fastLEDvelocity > 75 && fastLEDvelocity <= 80){
currentPalette = OceanColors_p;
currentBlending = LINEARBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//cloud
if (fastLEDnote[0] == true && fastLEDvelocity > 80 && fastLEDvelocity <= 85){
currentPalette = LavaColors_p;
currentBlending = LINEARBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//cloud
if (fastLEDnote[0] == true && fastLEDvelocity > 85 && fastLEDvelocity <= 90){
currentPalette = CloudColors_p;
currentBlending = LINEARBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//forest
if (fastLEDnote[0] == true && fastLEDvelocity > 90 && fastLEDvelocity <= 95){
currentPalette = ForestColors_p;
currentBlending = LINEARBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//rainbow
if (fastLEDnote[0] == true && fastLEDvelocity > 95 && fastLEDvelocity <= 100){
currentPalette = PartyColors_p;
currentBlending = LINEARBLEND;
FillLEDsFromPaletteColors(startIndex);
}
//shooting star
if (count1 < REAL_NUM_LEDS) { // Forward direction option for LEDs
leds[count1 % (REAL_NUM_LEDS + 1)].setRGB(255, 0, 0); // Set LEDs with the color value
count1++;
}
if (count2 < REAL_NUM_LEDS) { // Forward direction option for LEDs
leds[count2 % (REAL_NUM_LEDS + 1)].setRGB(0, 255, 0); // Set LEDs with the color value
count2++;
}
if (count3 < REAL_NUM_LEDS) { // Forward direction option for LEDs
leds[count3 % (REAL_NUM_LEDS + 1)].setRGB(0, 0, 255); // Set LEDs with the color value
count3++;
}
if (count4 < REAL_NUM_LEDS) { // Forward direction option for LEDs
leds[count4 % (REAL_NUM_LEDS + 1)].setRGB(0, 255, 255); // Set LEDs with the color value
count4++;
}
if (count5 < REAL_NUM_LEDS) { // Forward direction option for LEDs
leds[count5 % (REAL_NUM_LEDS + 1)].setRGB(255, 0,255); // Set LEDs with the color value
count5++;
}
if (count6 < REAL_NUM_LEDS) { // Forward direction option for LEDs
leds[count6 % (REAL_NUM_LEDS + 1)].setRGB(255, 255, 255); // Set LEDs with the color value
count6++;
}
fadeToBlackBy(leds, REAL_NUM_LEDS, 50);
FastLED.show();
FastLED.delay(1000 / UPDATES_PER_SECOND);
}