CCCPaste

"Fade Brightness" rev_03

/********* Pleasedontcode.com **********

	Pleasedontcode thanks you for automatic code generation! Enjoy your code!

	- Terms and Conditions:
	You have a non-exclusive, revocable, worldwide, royalty-free license
	for personal and commercial use. Attribution is optional; modifications
	are allowed, but you're responsible for code maintenance. We're not
	liable for any loss or damage. For full terms,
	please visit pleasedontcode.com/termsandconditions.

	- Project: "Fade Brightness"
	- Source Code NOT compiled for: Arduino Nano
	- Source Code created on: 2024-07-09 19:05:12

********* Pleasedontcode.com **********/

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* fade red flashing */
/****** SYSTEM REQUIREMENT 2 *****/
	/* Create a pulsing red light effect on the WS2812B */
	/* LED strip connected to pin D2, utilizing the */
	/* FastLED library for smooth transitions. */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/
#include     //https://github.com/FastLED/FastLED

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void);

/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t DATA_PIN = 2;

/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool WS2812B_WS2812B_DIN_PIN_D2_rawData = 0;

/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float WS2812B_WS2812B_DIN_PIN_D2_phyData = 0.0;

/****** DEFINITION OF LED STRIP PARAMETERS *****/
#define NUM_LEDS 60

/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
CRGB leds[NUM_LEDS]; // Array of LEDs

void setup(void)
{
    // put your setup code here, to run once:
    pinMode(DATA_PIN, OUTPUT);

    // Initialize the LED strip
    FastLED.addLeds(leds, NUM_LEDS);
}

void loop(void)
{
    // put your main code here, to run repeatedly:
    updateOutputs(); // Refresh output data

    // Fade red flashing effect
    for (int brightness = 0; brightness < 255; brightness++) {
        fill_solid(leds, NUM_LEDS, CRGB(brightness, 0, 0));
        FastLED.show();
        delay(10);
    }
    for (int brightness = 255; brightness >= 0; brightness--) {
        fill_solid(leds, NUM_LEDS, CRGB(brightness, 0, 0));
        FastLED.show();
        delay(10);
    }
}

void updateOutputs()
{
    digitalWrite(DATA_PIN, WS2812B_WS2812B_DIN_PIN_D2_rawData);
}

/* END CODE */