With some minor tweaking of your code I was able to trim it down form 4204 to 4,084 bytes but I am compiling it with an UNO so try it out maybe I freed up enough room for your random functions.
Good Luck
#include <FastLED.h>
CRGB leds[12];
int MotionRead;
int Motion;
byte ledProgram;
byte oldValue;
unsigned long timer;
unsigned long timer1;
byte y;
void AllLEDs(byte H, byte S, byte V);
void pulsingWhite();
void rainbow();
void solidWhite();
void off();
void setup() {
//Serial.begin(115200);
FastLED.addLeds<WS2812B, 1>(leds, 12);
MotionRead = analogRead(1);
Motion = map(MotionRead, 0, 1023, 0, 255);
oldValue = Motion;
}
void loop() {
MotionRead = analogRead(1);
Motion = map(MotionRead, 0, 1023, 0, 255);
solidWhite();
if (Motion - oldValue > 15 || oldValue - Motion > 15) {
oldValue = Motion;
// if (millis() > timer1 + 1000) {
if ((millis() - timer1) >= 1000) { // not that it matters with your sketch but this will not suffer rollover issues after leaving it on for a long time
ledProgram++;
timer1 = millis();
if (ledProgram > 4)ledProgram = 0;
}
}
switch (ledProgram) {
case 0:
{
solidWhite();
break;
}
case 1:
{
pulsingWhite();
break;
}
case 2:
{
candle();
break;
}
case 3:
{
rainbow();
break;
}
case 4:
{
off();
break;
}
}
FastLED.show();
}
void AllLEDs(byte H, byte S, byte V) {
for (int x = 0; x < 12; x++) {
leds[x] = CHSV(H, S , V);
}
}
void solidWhite() {
AllLEDs(0, 0, 255);
}
void pulsingWhite() {
// if (millis() > timer + 100) {
if ((millis() - timer) >= 100) { // not that it matters with your sketch but this will not suffer rollover issues after leaving it on for a long time
y++;
//if (y == 255)y = 0;//y is of type byte and will roll over to zero automatically
timer = millis();
}
AllLEDs(0, 0, y);
}
void candle() {
// if (millis() > timer + 10) {
if ((millis() - timer) >= 10) { // not that it matters with your sketch but this will not suffer rollover issues after leaving it on for a long time
AllLEDs(0, 0, 255);
timer = millis();
}
}
void rainbow() {
//if (millis() > timer + 100) {
if ((millis() - timer) >= 100) { // not that it matters with your sketch but this will not suffer rollover issues after leaving it on for a long time
y++;
// if (y == 255)y = 0; //y is of type byte and will roll over to zero automatically
timer = millis();
}
AllLEDs(y, 255, 255);
}
void off() {
AllLEDs(0, 0, 0);
}