int trig=12;
int echo=11;
const int LED=5;
const int LED1=6;
const int LED2=7;
long durasi, jarak;
void setup() {
  // put your setup code here, to run once:
  pinMode(trig, OUTPUT);
  pinMode(echo, INPUT);
  pinMode(LED, OUTPUT);
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(trig, LOW);
delayMicroseconds(8);
digitalWrite(trig, HIGH);
delayMicroseconds(8);
digitalWrite(trig, LOW);
delayMicroseconds(8);

durasi=pulseIn(echo, HIGH);
jarak=(durasi/2)/29.1;
Serial.println(jarak);

if((jarak>1)&&(jarak<=10)){
  Serial.println("sedikit penuh");
  digitalWrite(LED, HIGH);
  digitalWrite(LED1, LOW);
  digitalWrite(LED2, LOW);
}else if((jarak>9)&&(jarak<=20)){
  Serial.println("setengah penuh");
  digitalWrite(LED, LOW);
  digitalWrite(LED1, HIGH);
  digitalWrite(LED2, LOW);
}else if((jarak>19)&&(jarak<=30)){
  Serial.println("penuh");
  digitalWrite(LED, LOW);
  digitalWrite(LED1, LOW);
  digitalWrite(LED2, HIGH);
}
}