int trigPin = 5;
int echoPin = 4;
int merah = 13;
int kuning = 11;
long duration;
int distance;

void setup()
{
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(merah, OUTPUT);
  pinMode(kuning, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(9600);
  Serial.println("Serial Started...");
}

void loop()
{
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn (echoPin, HIGH);
  distance = (duration * 0.034) / 2;
  Serial.print("Jarak: ");
  Serial.println(distance);

  if (distance <= 150) {
    digitalWrite(merah, HIGH);
    digitalWrite(kuning, LOW);    
  }
  else {
    digitalWrite(merah, LOW);
    digitalWrite(kuning, HIGH);
  }
}