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: Arduino Blink
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2025-10-06 22:45:14
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* give me example led */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h> // LINE 2: Include Arduino core library
- /****** FUNCTION PROTOTYPES *****/
- void setup(void); // LINE 5: Prototype for setup
- void loop(void); // LINE 6: Prototype for loop
- /***** LED example configuration *****/
- const uint8_t LED_PIN = 13; // Built-in LED on UNO
- unsigned long previousMillis = 0; // Tracks last blink time
- const unsigned long interval = 500; // Blink interval in milliseconds
- bool ledState = false; // Current LED state
- void setup(void) // Start of setup
- {
- // put your setup code here, to run once:
- pinMode(LED_PIN, OUTPUT); // Configure LED_PIN as output
- digitalWrite(LED_PIN, LOW); // Turn LED off initially
- // LED example initialisation complete
- }
- void loop(void) // Start of loop
- {
- // put your main code here, to run repeatedly:
- unsigned long currentMillis = millis(); // Read current time in ms
- if (currentMillis - previousMillis >= interval) // Check for interval elapsed
- {
- previousMillis = currentMillis; // Update last blink time
- ledState = !ledState; // Toggle LED state
- digitalWrite(LED_PIN, ledState ? HIGH : LOW); // Write LED state
- }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment