#include LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup(){ lcd.begin(16, 2); Serial.begin(9600); pinMode(7, OUTPUT); // 7 = Trig pinMode(6, INPUT); // 6 = Echo delay(1000); lcd.clear(); } void loop(){ lcd.print("Distanca"); lcd.setCursor(0, 1); // print the number of seconds since reset: digitalWrite(7, HIGH); delayMicroseconds(2); digitalWrite(7, LOW); int pulseWidth = pulseIn(6, HIGH); Serial.print("Pulse Width: "); Serial.println(pulseWidth); long distance = (pulseWidth/29)/2; Serial.print("Distance: "); Serial.println(distance); lcd.print(distance); lcd.print(" Cm."); delay(1000); lcd.clear(); }