// setup
// LED & Push Button
int merah = 23; 
int hijau = 22;
int tombol = 2;

// Servo
#include <ESP32Servo.h>
Servo myservo;  
int pos = 0; 


void setup() 
{
  myservo.attach(15);  
  pinMode(tombol,OUTPUT); //PUSH BUTTON
  pinMode(merah,OUTPUT); //LED merah
  pinMode(hijau,OUTPUT); //LED kuning
  Serial.begin(115200);
}

void loop() 
{
  if (digitalRead(tombol) == LOW){
    digitalWrite(merah, HIGH);
    digitalWrite(hijau, LOW);
    myservo.write(0);
  }
  if (digitalRead(tombol) == HIGH){
    digitalWrite(merah, LOW);
    digitalWrite(hijau, HIGH);
    myservo.write(180);
  }
}