I found this on the internet and it is similar but I do not know how to put the two touch keys
// Program: Distance meter with HC-SR04
// Author: Arduino e Cia
#include <Ultrasonic.h> // Loads the Ultrasonic library
#include <LiquidCrystal.h> // Load the LCD library
// Defines the Arduino pin to be used with the sensor Trigger Pin
#define PINO_TRIGGER 13
// Defines the Arduino pin to be used with the Echo pin of the sensor
#define PINO_ECHO 10
// Initializes the ultrasonic sensor
Ultrasonic ultrasonic (PINO_TRIGGER, PINO_ECHO);
// Defines the pins that will be connected to the LCD
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
void setup ()
{
Serial.begin (9600); // Initialize the serial
lcd.begin (16.2); // Initialize LCD
lcd.clear (); // Clean LCD
}
void loop ()
{
float cmMsec, inMsec;
// Le sensor data, with signal return time
long microsec = ultrasonic.timing ();
// Calculate distance in centimeters
cmMsec = ultrasonic.convert (microsec, Ultrasonic :: CM);
// Calculate the distance in inches
inMsec = ultrasonic.convert (microsec, Ultrasonic :: IN);
// Displays the data, in centimeters, on the LCD and Serial
lcd.setCursor (0,0);
lcd.print ("Cent .:");
lcd.print ("");
lcd.setCursor (7,0);
lcd.print (cmMsec);
Serial.print ("Cent:");
Serial.print (cmMsec);
// Displays the data, in inches, on the LCD and Serial
lcd.setCursor (0,1);
lcd.print ("Pol.:");
lcd.print ("");
lcd.setCursor (7,1);
lcd.print (inMsec);
Serial.print (", Pol.:");
Serial.println (inMsec);
delay (1000);
}