#include <LiquidCrystal.h>
LiquidCrystal LCD (12,11,10,9,8,7); // pin rs, en, d4, d5, d6, d7
#define PIN_TRIG 2 //تعريف البنه اللي بديها اشاره لتشغيل السينسور
#define PIN_ECHO 3 //تعريف البنه اللي بستقبل منها اشاره من السينسور و هي اشاره صوتيه و بحسب من خلال سرعه الصوت الزمن و بالتالي باحسب المسافه
int t = 0 ;
void setup() {
// put your setup code here, to run once:
LCD.begin(16,2);
LCD.print("Hellow World");
LCD.setCursor(4,1);
LCD.print("Marko");
delay(2000);
LCD.clear();
pinMode(PIN_TRIG, OUTPUT);
pinMode(PIN_ECHO, INPUT);
}
void loop() {
digitalWrite(PIN_TRIG, LOW);
delayMicroseconds(5);
digitalWrite(PIN_TRIG, HIGH);
delayMicroseconds(10); //to send signal 10 ms to make sensor work
digitalWrite(PIN_TRIG, LOW);
t=pulseIn(PIN_ECHO,HIGH); //
LCD.setCursor(0,0);
LCD.print("Distance in CM: ");
LCD.setCursor(0,1);
LCD.print(t / 58);
LCD.print(" ");
delay(10);
}
/*
Functions
LiquidCrystal()
begin()
clear()
home()
setCursor()
write()
print()
cursor()
noCursor()
blink()
noBlink()
display()
noDisplay()
scrollDisplayLeft()
scrollDisplayRight()
autoscroll()
noAutoscroll()
leftToRight()
rightToLeft()
createChar()
*/