/********* 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: Trafficlightcontroller
- Source Code compiled for: Arduino Uno
- Source Code created on: 2023-11-21 00:50:22
- Source Code generated by: electronics
********* Pleasedontcode.com **********/
/****** DEFINITION OF LIBRARIES *****/
#include
/****** SYSTEM REQUIREMENT 1 *****/
/* Turn green led for 10s and red for 5s Blue for 5s */
/****** SYSTEM REQUIREMENT 2 *****/
/* Turn green led for 10s and red for 5s Blue for 5s */
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t Led_LEDRGB_Red_PIN_D2 = 2; // Define pin D2 for red LED
const uint8_t Led_LEDRGB_Green_PIN_D3 = 3; // Define pin D3 for green LED
const uint8_t Led_LEDRGB_Blue_PIN_D4 = 4; // Define pin D4 for blue LED
void setup(void)
{
// Set the LED pins as outputs
pinMode(Led_LEDRGB_Red_PIN_D2, OUTPUT);
pinMode(Led_LEDRGB_Green_PIN_D3, OUTPUT);
pinMode(Led_LEDRGB_Blue_PIN_D4, OUTPUT);
}
void loop(void)
{
// System Requirement 1: Turn green LED on for 10 seconds, then red LED for 5 seconds, and blue LED for 5 seconds
digitalWrite(Led_LEDRGB_Green_PIN_D3, HIGH); // Turn on green LED
delay(10000); // Wait for 10 seconds
digitalWrite(Led_LEDRGB_Green_PIN_D3, LOW); // Turn off green LED
digitalWrite(Led_LEDRGB_Red_PIN_D2, HIGH); // Turn on red LED
delay(5000); // Wait for 5 seconds
digitalWrite(Led_LEDRGB_Red_PIN_D2, LOW); // Turn off red LED
digitalWrite(Led_LEDRGB_Blue_PIN_D4, HIGH); // Turn on blue LED
delay(5000); // Wait for 5 seconds
digitalWrite(Led_LEDRGB_Blue_PIN_D4, LOW); // Turn off blue LED
// System Requirement 2: Turn green LED on for 10 seconds, then red LED for 5 seconds, and blue LED for 5 seconds
digitalWrite(Led_LEDRGB_Green_PIN_D3, HIGH); // Turn on green LED
delay(10000); // Wait for 10 seconds
digitalWrite(Led_LEDRGB_Green_PIN_D3, LOW); // Turn off green LED
digitalWrite(Led_LEDRGB_Red_PIN_D2, HIGH); // Turn on red LED
delay(5000); // Wait for 5 seconds
digitalWrite(Led_LEDRGB_Red_PIN_D2, LOW); // Turn off red LED
digitalWrite(Led_LEDRGB_Blue_PIN_D4, HIGH); // Turn on blue LED
delay(5000); // Wait for 5 seconds
digitalWrite(Led_LEDRGB_Blue_PIN_D4, LOW); // Turn off blue LED
}