NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#define echoPin 12 //Ultrasonik sensörün echo pini Arduino'nun 12.pinine
#define trigPin 13 //Ultrasonik sensörün trig pini Arduino'nun 13.pinine tanımlandı.
#define MotorR1 7
#define MotorR2 6
#define MotorRE 9 // Motor pinlerini tanımlıyoruz.
#define MotorL1 5
#define MotorL2 4
#define MotorLE 3
long sure, uzaklik; //süre ve uzaklık diye iki değişken tanımlıyoruz.
void setup() {
// ultrasonik sensör Trig pininden ses dalgaları gönderdiği için OUTPUT (Çıkış),
// bu dalgaları Echo pini ile geri aldığı için INPUT (Giriş) olarak tanımlanır.
pinMode(echoPin, INPUT);
pinMode(trigPin, OUTPUT);
pinMode(MotorL1, OUTPUT);
pinMode(MotorL2, OUTPUT);
pinMode(MotorLE, OUTPUT); //Motorlarımızı çıkış olarak tanımlıyoruz.
pinMode(MotorR1, OUTPUT);
pinMode(MotorR2, OUTPUT);
pinMode(MotorRE, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(trigPin, LOW); //sensör pasif hale getirildi
delayMicroseconds(5);
digitalWrite(trigPin, HIGH); //Sensore ses dalgasının üretmesi için emir verildi
delayMicroseconds(10);
digitalWrite(trigPin, LOW); //Yeni dalgaların üretilmemesi için trig pini LOW konumuna getirildi
sure = pulseIn(echoPin, HIGH); //ses dalgasının geri dönmesi için geçen sure ölçülüyor
uzaklik = sure / 29.1 / 2; //ölçülen süre uzaklığa çevriliyor
Serial.println(uzaklik);
if (uzaklik < 15) // Uzaklık 15'den küçük ise,
{
geri(); // 150 ms geri git
delay(150);
sag(); // 250 ms sağa dön
delay(250);
}
else { // değil ise,
ileri(); // ileri git
}
}
void ileri(){ // Robotun ileri yönde hareketi için fonksiyon tanımlıyoruz.
digitalWrite(MotorR1, HIGH); // Sağ motorun ileri hareketi aktif
digitalWrite(MotorR2, LOW); // Sağ motorun geri hareketi pasif
analogWrite(MotorRE, 150); // Sağ motorun hızı 150
digitalWrite(MotorL1, HIGH); // Sol motorun ileri hareketi aktif
digitalWrite(MotorL2, LOW); // Sol motorun geri hareketi pasif
analogWrite(MotorLE, 150); // Sol motorun hızı 150


}
void sag(){ // Robotun sağa dönme hareketi için fonksiyon tanımlıyoruz.
digitalWrite(MotorR1, HIGH); // Sağ motorun ileri hareketi aktif
digitalWrite(MotorR2, LOW); // Sağ motorun geri hareketi pasif
analogWrite(MotorRE, 0); // Sağ motorun hızı 0 (Motor duruyor)
digitalWrite(MotorL1, HIGH); // Sol motorun ileri hareketi aktif
digitalWrite(MotorL2, LOW); // Sol motorun geri hareketi pasif
analogWrite(MotorLE, 150); // Sol motorun hızı 150


}
void geri(){ // Robotun geri yönde hareketi için fonksiyon tanımlıyoruz.
digitalWrite(MotorR1, LOW); // Sağ motorun ileri hareketi pasif
digitalWrite(MotorR2, HIGH); // Sağ motorun geri hareketi aktif
analogWrite(MotorRE, 150); // Sağ motorun hızı 150
digitalWrite(MotorL1, LOW); // Sol motorun ileri hareketi pasif
digitalWrite(MotorL2, HIGH); // Sol motorun geri hareketi aktif
analogWrite(MotorLE, 150); // Sol motorun hızı 150

}
     
 
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.