NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/* Engelden Kaçan Araç */
int sure = 0;
int mesafe = 0;

const int trig_pin = 3;
const int echo_pin = 2;
const int sag_enable = 11; // ENABLE A
const int sag_ileri = 10; // INPUT 1
const int sag_geri = 9; // INPUT 2
const int sol_ileri = 8; // INPUT 3
const int sol_geri = 7; // INPUT 4
const int sol_enable = 6; // ENABLE B

void setup(){
pinMode(trig_pin, OUTPUT);
pinMode(echo_pin, INPUT );
pinMode(sag_ileri, OUTPUT);
pinMode(sag_geri, OUTPUT);
pinMode(sol_ileri, OUTPUT);
pinMode(sol_geri, OUTPUT);
pinMode(sag_enable, OUTPUT);
pinMode(sol_enable, OUTPUT);
Serial.begin(9600);
}

void loop(){
digitalWrite(trig_pin, HIGH);
delayMicroseconds(10);
digitalWrite(trig_pin, LOW);
sure = pulseIn(echo_pin, HIGH);
mesafe = (sure / 2) / 29.1;
Serial.println(mesafe);

if (mesafe < 10) { // Mesafe 10 cm den küçükse
// Motorlar kitlenerek araç durdurulur
digitalWrite(sag_ileri, LOW);
digitalWrite(sag_geri, LOW);
digitalWrite(sol_ileri, LOW);
digitalWrite(sol_geri, LOW);
delay(500);

// Araç geriye doğru hareket ettirilir
digitalWrite(sag_ileri, LOW);
digitalWrite(sag_geri, HIGH);
digitalWrite(sol_ileri, LOW);
digitalWrite(sol_geri, HIGH);
analogWrite(sag_enable, 200); // Motor hızları 200 PWM
analogWrite(sol_enable, 200);
delay(500);

// Araç sola döndürülür
digitalWrite(sag_ileri, HIGH);
digitalWrite(sag_geri, LOW);
digitalWrite(sol_ileri, LOW);
digitalWrite(sol_geri, HIGH);
analogWrite(sag_enable, 100); // Motor hızları 100 PWM
analogWrite(sol_enable, 100);
delay(500);
}

else if (mesafe >= 10 && mesafe < 40) { // Mesafe 10 cm ile 40 cm arasında ise
// Araç sağa dön
digitalWrite(sag_ileri, LOW);
digitalWrite(sag_geri, HIGH);
digitalWrite(sol_ileri, HIGH);
digitalWrite(sol_geri, LOW);
analogWrite(sag_enable, 200); // Motor hızları 200 PWM
analogWrite(sol_enable, 200);
}

else { // Mesafe 40 cm den büyükse
// Araç ileri git
digitalWrite(sag_ileri, HIGH);
digitalWrite(sag_geri, LOW);
digitalWrite(sol_ileri, HIGH);
digitalWrite(sol_geri, LOW);
analogWrite(sag_enable, 255); // Motor hızları 255 PWM
analogWrite(sol_enable, 255);
}
}
     
 
what is notes.io
 

Notes is a web-based application for online 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 14 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.