/********* 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: RGB LED Control
	- Source Code NOT compiled for: Arduino Uno
	- Source Code created on: 2024-04-27 16:00:39

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

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* In a cycle, automatically turn on led for only 30 */
	/* sec then stop for 10 sec and repreat */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/

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

/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t led_LEDRGB_Red_PIN_D2     = 2;
const uint8_t led_LEDRGB_Green_PIN_D3   = 3;
const uint8_t led_LEDRGB_Blue_PIN_D4    = 4;

/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool    led_LEDRGB_Red_PIN_D2_rawData   = 0;
bool    led_LEDRGB_Green_PIN_D3_rawData = 0;
bool    led_LEDRGB_Blue_PIN_D4_rawData  = 0;

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

unsigned long previousMillis = 0;
const long onTime = 30000; // 30 seconds
const long offTime = 10000; // 10 seconds
bool ledState = LOW;

void setup(void)
{
    // put your setup code here, to run once:
    pinMode(led_LEDRGB_Red_PIN_D2,   OUTPUT);
    pinMode(led_LEDRGB_Green_PIN_D3, OUTPUT);
    pinMode(led_LEDRGB_Blue_PIN_D4,  OUTPUT);
}

void loop(void)
{
    // put your main code here, to run repeatedly:
    unsigned long currentMillis = millis();

    if (ledState == LOW && currentMillis - previousMillis >= offTime)
    {
        previousMillis = currentMillis;
        ledState = HIGH;
    }
    else if (ledState == HIGH && currentMillis - previousMillis >= onTime)
    {
        previousMillis = currentMillis;
        ledState = LOW;
    }

    digitalWrite(led_LEDRGB_Red_PIN_D2, ledState);
    digitalWrite(led_LEDRGB_Green_PIN_D3, ledState);
    digitalWrite(led_LEDRGB_Blue_PIN_D4, ledState);
}

/* END CODE */