Car status display

Hello!

I am Hungarian google translator I write may not be perfect translation.

I’ve never programmed arduino before, but I started a big project, it doesn’t go alone.
Vw vento would have such a status display.
-Oil temperature gauge
-fuel flow
-shifting radar (sounds less than 30cm with a speaker) with ultrasonic sensor
-Liquidcristal I2C prints the information. (16.2)
Use the button to switch between menu items.

The problem so far is that I can't program such a menu.

Could you help me?

my program, which I have programmed so far:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
const int SENSOR_PIN = 13;
const int trigPin = 2;
const int echoPin = 4;
const int BUZZER_PIN = 3;
const int DISTANCE_THRESHOLD = 31;
float duration_us, distance_cm;
#define ADC_VREF_mV 5000.0 // in millivolt
#define ADC_RESOLUTION 1024.0
#define PIN_LM35 A0

LiquidCrystal_I2C lcd(0x27,20,4);

void setup()
{
Serial.begin(9600);

lcd.init();
lcd.init();

lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Homer::");
lcd.setCursor(0,1);
lcd.print("Tavolsag:");

pinMode(BUZZER_PIN, OUTPUT);

}

void loop()
{

long duration, cm;
pinMode(trigPin, OUTPUT);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

cm = microsecondsToCentimeters(duration);

Serial.print(cm);
Serial.print("cm");
Serial.println();

lcd.setCursor(11,1);
lcd.print(cm);
lcd.print("cm");
lcd.println();

delay(100);

if( cm = microsecondsToCentimeters(duration) < DISTANCE_THRESHOLD)
digitalWrite(BUZZER_PIN, HIGH);
digitalWrite(BUZZER_PIN, LOW);

int adcVal = analogRead(PIN_LM35);
float milliVolt = adcVal * (ADC_VREF_mV / ADC_RESOLUTION);
float tempC = milliVolt / 10;

Serial.print(tempC);
Serial.print("°C");

lcd.setCursor(9,0);
lcd.print(tempC);
lcd.print("C");
lcd.println();

delay(10);

}
long microsecondsToInches(long microseconds)
{return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds)
{return microseconds / 29 / 2;}

Hello
You may not do the coding from the scratch. That doing will result in spaghetti code.
Take some time and study the IPO model, lay back and thing about and than start to design a programe structure by using a pencil and a piece of paper.
All program blocks can be coded and tested separtly. And finally all blocks can linked logically together et voilà the project ist ready. :nerd_face:
Have a nice day and enjoy coding in C++.

You've already calculate "cm" here, so

if( cm  < DISTANCE_THRESHOLD)

would be sufficient.