Any problem with my Arduino circuit?

int Limit = 27; //height limit of your garbage bin in cm
const int trigPin = 8;
const int echoPin = 9;
long duration, distance, range;

void setup()
{
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop()
{
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);  
  digitalWrite(trigPin, HIGH);  
  delayMicroseconds(10);  
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1 / Limit * 100;
  range = 100 - distance;

if ((range >= 0) && (range <= 100))
  {
    if (range > 70)
      {
        Serial.print("F");
      }
    if ((range >= 30) && (range <= 70))
      {
        Serial.print("M");
      }
    if (range <= 30)
      {
        Serial.print("E");
      }
    
     Serial.print(range);
     Serial.println();
     delay(500);
  }
  
else
 {
  Serial.print("F 100");
  Serial.println();
  delay(500);
 }

}

This is my Arduino circuit..







Do not create spam topics

1 Like

How do i delete this

1 Like

Click the ••• option and click the trash icon. Thats it

Then I am flagging it for you

I think you have not got TL1 or 2 thats why

EDIT: Done flagging it!

What is the use of flagging?

Flagging is a very special feature to remove duplications, spam topics, and rude behavior

1 Like