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: "Color Cycle"
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-12-03 20:34:56
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* its a led module */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h> // Include Arduino library for basic functions
- // Define pins for RGB LED
- #define RED_PIN 9
- #define GREEN_PIN 10
- #define BLUE_PIN 11
- // Define variables for RGB values
- int redValue = 0;
- int greenValue = 0;
- int blueValue = 0;
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void setup(void)
- {
- // Set RGB pins as output
- pinMode(RED_PIN, OUTPUT);
- pinMode(GREEN_PIN, OUTPUT);
- pinMode(BLUE_PIN, OUTPUT);
- }
- void loop(void)
- {
- // Set RGB values to random values between 0 and 255
- redValue = random(0, 256); // Changed to 256 to include 255
- greenValue = random(0, 256); // Changed to 256 to include 255
- blueValue = random(0, 256); // Changed to 256 to include 255
- // Write RGB values to corresponding pins
- analogWrite(RED_PIN, redValue);
- analogWrite(GREEN_PIN, greenValue);
- analogWrite(BLUE_PIN, blueValue);
- // Delay for 1 second
- delay(1000);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement