NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

// CLK - Pin 8
// DIN - Pin 9
// DC - Pin 10
// RST - Pin 11
// CE - Pin 12
// VCC - 3.3V
// GND - GND

#include <LCD5110_Graph.h>

#define echoPin 6 // HC-SR04 ULTRASONİK SENSÖRÜN Echo Pini
#define trigPin 7 // HC-SR04 ULTRASONİK SENSÖRÜN Trigger Pini

LCD5110 lcd(8,9,10,11,12);//LCD pinlerinin hangi Arduino pinlerine bağlı olduğunu belirtiyoruz.
extern unsigned char BigNumbers[]; // Büyük sayıları yazmamızı sağlayan BigNumbers'ı tanıtıyoruz.
extern unsigned char SmallFont[];// Küçük harflerle yazı yazmamızı sağlayan SmallFont'u tanıtıyoruz.
int maximumRange = 999; // Maksimum aralık
int minimumRange = 1; // Minimum aralık
long duration, MESAFE; // Mesafeyi hesaplamak için kullanılan süre
const int led1 = 2;// PİNLERİMİZİ TANIMLADIK.
const int led2 = 3;// PİNLERİMİZİ TANIMLADIK.
const int led3 = 4; // PİNLERİMİZİ TANIMLADIK.
const int led4 = 5;// PİNLERİMİZİ TANIMLADIK.
const int buzzer = 13;// PİNLERİMİZİ TANIMLADIK.
String MESAFEString = "0";

void setup() {
pinMode(trigPin, OUTPUT);//ÇIKIŞ PİNİ OLDUĞUNU BELİRLEDİK.
pinMode(echoPin, INPUT);//GİRİŞ PİNİ OLDUĞUNU BELİRLEDİK.
pinMode(led1, OUTPUT);//ÇIKIŞ PİNİ OLDUĞUNU BELİRLEDİK.
pinMode(led2, OUTPUT);//ÇIKIŞ PİNİ OLDUĞUNU BELİRLEDİK.
pinMode(led3, OUTPUT);//ÇIKIŞ PİNİ OLDUĞUNU BELİRLEDİK.
pinMode(led4, OUTPUT);//ÇIKIŞ PİNİ OLDUĞUNU BELİRLEDİK.
pinMode(buzzer, OUTPUT);//ÇIKIŞ PİNİ OLDUĞUNU BELİRLEDİK.

lcd.InitLCD(); //Ekranı başlatıyoruz.
lcd.setFont(SmallFont);// Küçük harflerle yazı yazmamızı sağlayan SmallFont'u tanıtıyoruz.
lcd.print("MEHMETCAN",CENTER,8);
lcd.print("TABAN",CENTER,16);
lcd.print("80160000334",CENTER,24);
lcd.print("ULTRASONIK",CENTER,32);
lcd.print("SENSOR",CENTER,40);
lcd.update();
delay(5000);
lcd.clrScr();
lcd.setFont(BigNumbers);
}

void loop() {
int stringLength = 0;

lcd.clrScr();
lcd.setFont(SmallFont);
lcd.print("MESAFE(CM)",CENTER,6);
MESAFEString = readSensor();

stringLength = MESAFEString.length();
printMESAFE(stringLength);
lcd.update();
delay(50);
}

void printMESAFE(int length)
{
switch(length)
{
case 1: lcd.print(MESAFEString,36,23); break;
case 2: lcd.print(MESAFEString,36,23); break;
case 3: lcd.print(MESAFEString,36,23); break;
default: lcd.print(MESAFEString,36,23); break;
}
}

String readSensor()
{
String MESAFES = "0";
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);

digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);

MESAFE = (duration/2) / 26.5;
MESAFES = String(MESAFE);
if(MESAFE>maximumRange || MESAFE<minimumRange)
{
MESAFES = "---";
}

if(MESAFE>=0 && MESAFE<25)
{
digitalWrite(led1, HIGH);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(led1, LOW);
digitalWrite(buzzer, LOW);
delay(90);

}
else if(MESAFE>=25 && MESAFE<50)
{
digitalWrite(led2, HIGH);
digitalWrite(buzzer, HIGH);
delay(200);
digitalWrite(led2, LOW);
digitalWrite(buzzer, LOW);
delay(150);
}
else if(MESAFE>=50 && MESAFE<75)
{
digitalWrite(led3, HIGH);
digitalWrite(buzzer, HIGH);
delay(350);
digitalWrite(led3, LOW);
digitalWrite(buzzer, LOW);
delay(250);
}
else if (MESAFE>=75)
{
digitalWrite(led4, HIGH);
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(led4, LOW);
digitalWrite(buzzer, LOW);

delay(450);
}


return MESAFES;
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.