Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: Colorful Control
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-05-01 10:45:04
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* chipset WS2812B RGB Number of LED 20 Output D5 */
- /* fade in and out from 0 to 255 color random set */
- /* fade out value at 255 use all colors randomly for */
- /* each led and */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <FastLED.h> //https://github.com/FastLED/FastLED
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void updateOutputs(void); // Added function prototype for updateOutputs
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t WS2812B_LEDRGB_PIN_D5 = 5; // Define the output pin for WS2812B LED
- /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
- /***** used to store raw data *****/
- bool WS2812B_LEDRGB_PIN_D5_rawData = 0;
- /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
- /***** used to store data after characteristic curve transformation *****/
- float WS2812B_LEDRGB_PIN_D5_phyData = 0.0;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- CRGB leds[20]; // Define the LED array based on the number of LEDs
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(WS2812B_LEDRGB_PIN_D5, OUTPUT);
- FastLED.addLeds<WS2812B, WS2812B_LEDRGB_PIN_D5, GRB>(leds, 20); // Initialize FastLED object with LED array and pin configuration
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- updateOutputs(); // Refresh output data
- }
- void updateOutputs()
- {
- // Fade in and out from 0 to 255 with random colors for each LED
- for (int i = 0; i < 20; i++) {
- leds[i] = CHSV(random8(), 255, 255); // Set random hue, full saturation, and full value (brightness)
- }
- FastLED.show(); // Show the updated LED colors
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement