Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* 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: FastLED Control - Source Code NOT compiled for: Arduino Uno - Source Code created on: 2024-05-01 09:51:01 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* The LED chipset is WS2812B RGB Number of LED is */ /* 20 Digital output is D5 all 20 led fade in and */ /* out slowly and randomly. set fade in value at 0, */ /* set fade out value at 255 use all colors randomly */ /* for each led and */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/FastLED/FastLED const uint8_t NUM_LEDS = 20; // Number of WS2812B RGB LEDs const uint8_t WS2812B_LEDRGB_PIN = 5; // Digital output pin for WS2812B LEDs CRGB leds[NUM_LEDS]; // Define the LED array void setup(void) { // put your setup code here, to run once: FastLED.addLeds
(leds, NUM_LEDS); } void loop(void) { // put your main code here, to run repeatedly: fadeInOutRandomColors(); } void fadeInOutRandomColors() { for (int i = 0; i < NUM_LEDS; i++) { leds[i] = CRGB(0, 0, 0); // Initialize LED color to off } while (true) { for (int i = 0; i < NUM_LEDS; i++) { leds[i].fadeToBlackBy(5); // Fade out LED color } int ledIndex = random8(NUM_LEDS); // Select a random LED leds[ledIndex] = CRGB(random8(), random8(), random8()); // Set random color to the selected LED leds[ledIndex].fadeToBlackBy(-5); // Fade in LED color FastLED.show(); delay(50); // Adjust the delay time for fade effect } } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)