#define LED_R 12
#define LED_P 27
#define LED_Y 14
#define LDR 16
#define PIR 34
byte LDR_value = 0;
byte PIR_value = 0 ;

#define button_R 13
#define button_Y 26
#define button_G 25
#define LED_R 19
#define LED_Y 18
#define LED_G 5
int bnR =0;
int bnY =0;
int bnG =0;

void setup() {
  Serial.begin(115200);
  pinMode(LED_R, OUTPUT);
  pinMode(LED_P, OUTPUT);
  pinMode(LED_Y, OUTPUT);
  pinMode(LDR, INPUT);
  Serial.end();
  Serial.begin(115200);
  pinMode(LED_Y, OUTPUT);
  pinMode(LED_R, OUTPUT);
  pinMode(LED_G, OUTPUT);
  pinMode(button_R, INPUT);
  pinMode(button_Y, INPUT);
  pinMode(button_G, INPUT);
} 
void loop() {
  LDR_value = digitalRead(LDR);
  Serial.println(LDR_value);
  if (LDR_value == 1) {
    digitalWrite(LED_R, HIGH);
    digitalWrite(LED_P, HIGH);
    digitalWrite(LED_Y, HIGH);
  }
  else{
    digitalWrite(LED_R, LOW);
    digitalWrite(LED_P, LOW);
    digitalWrite(LED_Y, LOW);
  }
   delay(500);
  
  bnR=digitalRead(button_R);
  bnY=digitalRead(button_Y);
  bnG=digitalRead(button_G);

  Serial.print(" Y : ");
  Serial.println(bnY);
  Serial.print(" R : ");
  Serial.println(bnR);
  Serial.print(" G : ");
  Serial.println(bnG);
  if (bnR== 1){
    digitalWrite(LED_R, HIGH);
    digitalWrite(LED_Y, LOW);
    digitalWrite(LED_G, LOW);
  }
  else if (bnY == 1) {
    digitalWrite(LED_R, LOW);
    digitalWrite(LED_Y, HIGH);
    digitalWrite(LED_G, LOW);
  }
  else if (bnG == 1) {
    digitalWrite(LED_R, LOW);
    digitalWrite(LED_Y, LOW);
    digitalWrite(LED_G, HIGH);
  }
  else{
    digitalWrite(LED_R, LOW);
    digitalWrite(LED_Y, LOW);
    digitalWrite(LED_G, LOW);
  
  }
  delay(100);

  PIR_value = digitalRead(PIR);
  Serial.println(PIR_value);
  delay(1000);

  if (PIR_value == 1) {
    digitalWrite(LED_R, HIGH);

  }
else{
    digitalWrite(LED_R, LOW);
  }
}

esp:0
esp:2
esp:4
esp:5
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:21
esp:22
esp:23
esp:25
esp:26
esp:27
esp:32
esp:33
esp:34
esp:35
esp:3V3
esp:EN
esp:VP
esp:VN
esp:GND.1
esp:D2
esp:D3
esp:CMD
esp:5V
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:D1
esp:D0
esp:CLK
ldr1:VCC
ldr1:GND
ldr1:DO
ldr1:AO
led1:A
led1:C
led2:A
led2:C
r1:1
r1:2
r2:1
r2:2
led3:A
led3:C
r3:1
r3:2
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r
r4:1
r4:2
r5:1
r5:2
r6:1
r6:2
pir1:VCC
pir1:OUT
pir1:GND