// Pin definitions for each LED color
int redLED = 2; // Red LED pin
int greenLED = 3; // Green LED pin
int yellowLED = 4; // Yellow LED pin
int blueLED = 5; // Blue LED pin
int violetLED = 6; // Violet LED pin
int whiteLED = 7; // White LED pin
// Time delay for showing each color (in milliseconds)
int delayTime = 2000; // 1 second delay for each transition
void setup() {
// Initialize the serial communication
Serial.begin(9600);
// Set LED pins as OUTPUT
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(blueLED, OUTPUT);
pinMode(violetLED, OUTPUT);
pinMode(whiteLED, OUTPUT);
}
void loop() {
// Display red LED for electron transition
digitalWrite(redLED, HIGH);
Serial.println("Electron jumps from 3rd to 1st orbit - Emitting RED light (620-750 nm)");
delay(delayTime);
digitalWrite(redLED, LOW);
// Display green LED for electron transition
digitalWrite(greenLED, HIGH);
Serial.println("Electron jumps from 3rd to 1st orbit - Emitting GREEN light (495-570 nm)");
delay(delayTime);
digitalWrite(greenLED, LOW);
// Display yellow LED for electron transition
digitalWrite(yellowLED, HIGH);
Serial.println("Electron jumps from 3rd to 1st orbit - Emitting YELLOW light (570-590 nm)");
delay(delayTime);
digitalWrite(yellowLED, LOW);
// Display blue LED for electron transition
digitalWrite(blueLED, HIGH);
Serial.println("Electron jumps from 3rd to 1st orbit - Emitting BLUE light (450-495 nm)");
delay(delayTime);
digitalWrite(blueLED, LOW);
// Display violet LED for electron transition
digitalWrite(violetLED, HIGH);
Serial.println("Electron jumps from 3rd to 1st orbit - Emitting VIOLET light (380-450 nm)");
delay(delayTime);
digitalWrite(violetLED, LOW);
// Display white LED for electron transition
digitalWrite(whiteLED, HIGH);
Serial.println("Electron jumps from 3rd to 1st orbit - Emitting WHITE light (Combination of all visible wavelengths)");
delay(delayTime);
digitalWrite(whiteLED, LOW);
// Add a brief pause between cycles
delay(2000);
}