CCCPaste

Button LED rev_06

/********* 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: Button LED
	- Source Code compiled for: Arduino Uno
	- Source Code created on: 2024-03-04 23:10:11

********* Pleasedontcode.com **********/

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* Once the push button linked to pin D2 is pressed, */
	/* the LED connected to pin D3 should instantly light */
	/* up and stay illuminated for 0.5 seconds before */
	/* automatically switching off. The LED will remain */
	/* off until the push button is released. */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/
#include 

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void);

/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t przycisk_PushButton_PIN_D2 = 2;

/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t lampka_LED_PIN_D3 = 3;

/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool lampka_LED_PIN_D3_rawData = LOW;

/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float lampka_LED_PIN_D3_phyData = 0.0;

void setup(void)
{
  pinMode(przycisk_PushButton_PIN_D2, INPUT_PULLUP);
  pinMode(lampka_LED_PIN_D3, OUTPUT);
}

void loop(void)
{
  // Check if the push button is pressed
  if (digitalRead(przycisk_PushButton_PIN_D2) == LOW)
  {
    // Turn on the LED
    digitalWrite(lampka_LED_PIN_D3, HIGH);
    delay(500); // Wait for 0.5 seconds
    digitalWrite(lampka_LED_PIN_D3, LOW); // Turn off the LED
    while (digitalRead(przycisk_PushButton_PIN_D2) == LOW)
    {
      // Wait until the push button is released
    }
  }
}

void updateOutputs(void)
{
  // No need to update outputs in this case
}