pleasedontcode

Blinking Hello rev_13

Oct 6th, 2025
155
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: Blinking Hello
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2025-10-06 23:19:20
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* give me example led */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23.  
  24. /* START CODE */
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. #include <Arduino.h>
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** LED example configuration *****/
  34. const uint8_t LED_PIN = 13; // Built-in LED on UNO
  35. unsigned long previousMillis = 0;
  36. const unsigned long interval = 500; // Blink interval in milliseconds
  37. bool ledState = false;
  38. unsigned long lastMessageMillis = 0;
  39.  
  40. void setup(void)
  41. {
  42.     // put your setup code here, to run once:
  43.     pinMode(LED_PIN, OUTPUT);
  44.     digitalWrite(LED_PIN, LOW);
  45.     // Initialize Serial for hello message
  46.     Serial.begin(9600);
  47.     Serial.println("Hello!");
  48.     // LED example initialisation complete
  49. }
  50.  
  51.  
  52. void loop(void)
  53. {
  54.     // put your main code here, to run repeatedly:
  55.     unsigned long currentMillis = millis();
  56.  
  57.     // Say "ciao" periodically
  58.     if (currentMillis - lastMessageMillis >= 1000)
  59.     {
  60.         lastMessageMillis = currentMillis;
  61.         Serial.println("ciao");
  62.     }
  63.  
  64.     if (currentMillis - previousMillis >= interval)
  65.     {
  66.         previousMillis = currentMillis;
  67.         ledState = !ledState;
  68.         digitalWrite(LED_PIN, ledState ? HIGH : LOW);
  69.     }
  70. }
  71.  
  72. /* END CODE */
  73.  
Advertisement
Add Comment
Please, Sign In to add comment