/********* 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: Traffic Control
	- Source Code compiled for: Arduino Uno
	- Source Code created on: 2024-02-10 07:15:14

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

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* turn on and off traffic lights when pressing a */
	/* button */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/
#include <Arduino.h>

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* turn on and off traffic lights when pressing a */
	/* button */
/****** END SYSTEM REQUIREMENTS *****/

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

/***** DEFINITION OF DIGITAL INPUT/OUTPUT PINS *****/
const uint8_t mybutton_PIN_D2 = 2;
const uint8_t mybutton_LED_PIN_D3 = 3;
const uint8_t mybutton_LED_PIN_D4 = 4;

/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
bool mybutton_LED_PIN_D3_rawData = 0;
bool mybutton_LED_PIN_D4_rawData = 0;

void setup(void)
{
  // put your setup code here, to run once:
  pinMode(mybutton_PIN_D2, INPUT_PULLUP);
  pinMode(mybutton_LED_PIN_D3, OUTPUT);
  pinMode(mybutton_LED_PIN_D4, OUTPUT);
}

void loop(void)
{
  // put your main code here, to run repeatedly:
  if (digitalRead(mybutton_PIN_D2) == LOW)
  {
    mybutton_LED_PIN_D3_rawData = !mybutton_LED_PIN_D3_rawData; // Toggle the state of LED_PIN_D3
    mybutton_LED_PIN_D4_rawData = !mybutton_LED_PIN_D4_rawData; // Toggle the state of LED_PIN_D4
    delay(500); // Debounce delay
  }
  
  updateOutputs(); // Refresh output data
}

void updateOutputs()
{
  digitalWrite(mybutton_LED_PIN_D3, mybutton_LED_PIN_D3_rawData);
  digitalWrite(mybutton_LED_PIN_D4, mybutton_LED_PIN_D4_rawData);
}
