#define redled1
#define yellowled1 
#define greenled1 
#define redled2 
#define yellowled2
#define greenled2 
#define redled3 
#define yellowled3 
#define greenled3 
#define ldr A5
#define led10
#define led11
#define led12
int nilai;

void setup() {
  // put your setup code here, to run once:
pinMode(redled1, OUTPUT);
pinMode(yellowled1, OUTPUT);
pinMode(greenled1, OUTPUT);
pinMode(redled2, OUTPUT);
pinMode(yellowled2, OUTPUT);
pinMode(greenled2, OUTPUT);
pinMode(redled3, OUTPUT);
pinMode(yellowled3, OUTPUT); 
pinMode(greenled3, OUTPUT);

Serial.begin (9600);
pinMode (led4,OUTPUT) ;
pinMode (led5,OUTPUT) ;
pinMode (led6, OUTPUT) ;
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(redled2, HIGH);
digitalWrite(redled3, HIGH);
digitalWrite(greenled1, HIGH);
delay(3000);
digitalWrite(greenled1, LOW);
digitalWrite(yellowled1, HIGH);
delay(1000);
digitalWrite(yellowled1, LOW);
digitalWrite(redled1, HIGH);
digitalWrite(redled2, LOW);
digitalWrite(yellowled2, HIGH);
delay(1000);
digitalWrite(yellowled2, LOW);
digitalWrite(greenled2, HIGH);
delay(3000);
digitalWrite(greenled2, LOW);
digitalWrite(yellowled2, HIGH);
delay(1000);
digitalWrite(yellowled2, LOW);
digitalWrite(redled2, HIGH);
digitalWrite(redled3, LOW);
digitalWrite(yellowled3, HIGH);
delay(1000);
digitalWrite(yellowled3, LOW);
digitalWrite(greenled3, HIGH);
delay(3000);
digitalWrite(greenled3, LOW);
digitalWrite(yellowled3, HIGH);
delay(1000);
digitalWrite(yellowled3, LOW);
digitalWrite(redled3, HIGH);
digitalWrite(redled1, LOW);
digitalWrite(yellowled1, HIGH);
delay(1000);
digitalWrite(yellowled1, LOW);
  
  nilai = analogRead (ldr) ;
  Serial.print("Nilai LDR : ") ;
  Serial.println (nilai);

  if(nilai < 500){
    digitalRead(led10, HIGH );
    digitalRead(led11, HIGH ) ;
    digitalRead(led12,HIGH ) ;
    Serial.println ("Keadaan gelap, lampu menyala");
  }else{
    digitalRead(led10 ,LOW );
    digitalRead(led11, LOW ) ;
    digitalRead(led12, LOW );
    Serial.println ("Keadaan terang, lampu mati ") ;
  }
  delay(1000);
}