/********* 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: "Fading Red" - Source Code NOT compiled for: Arduino Nano - Source Code created on: 2024-07-09 15:53:38 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* fade red flashing */ /****** 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 WS2812B_WS2812B_DIN_PIN_D2 = 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 LIBRARIES CLASS INSTANCES*****/ // Number of LEDs in the strip #define NUM_LEDS 60 // Data pin for the LED strip #define DATA_PIN WS2812B_WS2812B_DIN_PIN_D2 // Array of LEDs CRGB leds[NUM_LEDS]; void setup(void) { // put your setup code here, to run once: pinMode(WS2812B_WS2812B_DIN_PIN_D2, OUTPUT); // Delay for reprogramming delay(2000); // 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 < 256; brightness++) { fill_solid(leds, NUM_LEDS, CRGB(brightness, 0, 0)); // Increase brightness FastLED.show(); delay(10); } for (int brightness = 255; brightness >= 0; brightness--) { fill_solid(leds, NUM_LEDS, CRGB(brightness, 0, 0)); // Decrease brightness FastLED.show(); delay(10); } } void updateOutputs() { digitalWrite(WS2812B_WS2812B_DIN_PIN_D2, WS2812B_WS2812B_DIN_PIN_D2_rawData); } /* END CODE */