Need Help with Arduino Code

So I am making a smart dustbin for a small project , basically when the ultra sensory detects a distance outside the dustbin that is less than 10 cm it triggers the servo to open the bin , but now i want to add another ultra sensor inside the bin to measure the amount of trash inside the dustbin so when it reaches a level
here is the code i am using :

include <Servo.h>

define trigPin 7

define echoPin 6

Servo servo;
int sound = 250;
void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  servo.attach(8);
}
void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  if (distance < 10) {
    Serial.println("the distance is less than 10");
    servo.write(90);
    delay(100); 
  }
  else {
    servo.write(39);
  }
  if (distance > 10 || distance <= 0){
    Serial.println("The distance is more than 10");
  }
  else {
    Serial.print(distance);
    Serial.println(" cm");
  }
  delay(2000);
}

And where is your problem?
If you wrote above code yourself adding the logic for another sensor on two seperate pins would work just the same.

BTW, this is a Particle forum and we use D6 & D7 for pin names instead of anonymous numbers :wink:

I was wondering if you can help me atleast understand how to write the code for another sensory that would stop another sensory function or atleast halt the servo until a certain distance is reached

Btw am still a beginner :confused: