CCCPaste

RGB LED Fader rev_08

/********* 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: RGB LED Fader
	- Source Code NOT compiled for: Arduino Uno
	- Source Code created on: 2024-05-04 09:18:13

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

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* output d5  number of led 20  ws2812B RGB  use */
	/* random color  fade in and out in 10 seconds */
/****** 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 LEDBoard_LEDRGB_Red_PIN_D5	= 5; // Output pin for WS2812B RGB LED strip
#define NUM_LEDS 20 // Number of LEDs in the strip

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

// Define LED strip parameters
#define DATA_PIN 6
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB

CRGB leds[NUM_LEDS];

void setup(void)
{
	// put your setup code here, to run once:

	FastLED.addLeds(leds, NUM_LEDS);
	pinMode(LEDBoard_LEDRGB_Red_PIN_D5, OUTPUT);

}

void loop(void)
{
	// put your main code here, to run repeatedly:

	// Random color fade in and out in 10 seconds
	uint8_t brightness = beatsin8(60, 0, 255);
	uint8_t hue = beatsin8(40, 0, 255);
	fill_solid(leds, NUM_LEDS, CHSV(hue, 255, brightness));
	FastLED.show();
	delay(100); // Adjust the delay time for fade effect

}

void updateOutputs()
{
	digitalWrite(LEDBoard_LEDRGB_Red_PIN_D5, LEDBoard_LEDRGB_Red_PIN_D5_rawData);
}