pleasedontcode

LED Blinker rev_02

Aug 2nd, 2025
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: LED Blinker
  13.     - Source Code compiled for: Arduino Mega
  14.     - Source Code created on: 2025-08-02 18:34:12
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Use the onboard Arduino Mega's built-in LED (pin */
  21.     /* 13) to toggle its state every 3 seconds, ensuring */
  22.     /* the code references the correct pin and utilizes */
  23.     /* delay() for timing. */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26.  
  27. /* START CODE */
  28. /****** DEFINITION OF LIBRARIES *****/
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33.  
  34. const int ledPin = 13; // Onboard Arduino Mega LED pin
  35. bool ledState = LOW;   // Variable to hold LED state
  36.  
  37. void setup(void)
  38. {
  39.     // put your setup code here, to run once:
  40.     pinMode(ledPin, OUTPUT); // Initialize the LED pin as an output
  41. }
  42.  
  43. void loop(void)
  44. {
  45.     // Toggle the LED state
  46.     ledState = !ledState; // Invert the current state
  47.     digitalWrite(ledPin, ledState); // Set the LED to the new state
  48.     delay(3000); // Wait for 3 seconds
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment