NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <QTRSensors.h> //SERİ MONİTORLE İŞİN YOKSA SAKIN ACMA ROBOT KAFASINI SALLIYOR
//BEYAZ ZEMİN SİYAH ÇİZGİ VE ÇİZGİ ÜZERİNDE ENGEL VAR ENGELDEN KAÇIP TEKRAR ÇİZGİYE GİRİYOR
#define Kp .1
#define Kd 4
int maksimumhiz = 240;
int hiz = 180;
#define SensorSayisi 6
#define sagmi 11
#define sagmg 6
#define solmi 9
#define solmg 10
int sonhata = 0;
int zemin = 1; //siyah 1 beyaz 0

#define trig1 12
#define echo1 3
#define trig2 5
#define echo2 4
#define trig3 8
#define echo3 7

int engelsayac = 0;
int a=0;
int b=0;
int bsond = 0;
int c =0;



QTRSensorsAnalog qtra((unsigned char[]) {A0,A1,A2,A3,A4,A5} ,SensorSayisi);
unsigned int sensorler[SensorSayisi];



void setup(){
pinMode(trig1,OUTPUT);
pinMode(trig2,OUTPUT);
pinMode(trig3,OUTPUT);
pinMode(echo1,INPUT);
pinMode(echo2,INPUT);
pinMode(echo3,INPUT);


pinMode(sagmi,OUTPUT);
pinMode(sagmg,OUTPUT);
pinMode(solmi,OUTPUT);
pinMode(solmg,OUTPUT);
pinMode(13,OUTPUT);

pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(A3,INPUT);
pinMode(A4,INPUT);
pinMode(A5,INPUT);


for (int i = 0; i < 70; i++){
digitalWrite(13,HIGH);
delay(20);
qtra.calibrate();
digitalWrite(13,LOW);
delay(20);
}
delay(2000);




}

void loop(){
int sens2 = analogRead(A0);
int sens3 = analogRead(A1);
int sens4 = analogRead(A2);
int sens5 = analogRead(A3);
int sens6 = analogRead(A4);
int sens7 = analogRead(A5);


digitalWrite(trig1,LOW);
delayMicroseconds(2);
digitalWrite(trig1,HIGH);
delayMicroseconds(10); //SOLDAKİ MESAFE SENSORUNU OKUTTUK
digitalWrite(trig1,LOW);
int sure1 = pulseIn(echo1,HIGH);
int mesafe1 = (sure1/2) / 29.1;


digitalWrite(trig2,LOW);
delayMicroseconds(2);
digitalWrite(trig2,HIGH);
delayMicroseconds(10); //ORTADAKİ MESAFE SENSORUNU OKUTTUK
digitalWrite(trig2,LOW);
int sure2 = pulseIn(echo2,HIGH);
int mesafe2 = (sure2/2) / 29.1;


digitalWrite(trig3,LOW);
delayMicroseconds(2);
digitalWrite(trig3,HIGH);
delayMicroseconds(10); //SAGDAKİ MESAFE SENSORUNU OKUTTUK
digitalWrite(trig3,LOW);
int sure3 = pulseIn(echo3,HIGH);
int mesafe3 = (sure3/2) / 29.1;


digitalWrite(sagmg,LOW);
digitalWrite(solmg,LOW);
analogWrite(sagmi,hiz);
analogWrite(solmi,hiz);

if(mesafe2<15&&mesafe2>0){
b=1;
}
else{
b=0;
}

if(b != bsond){
if(b==1){
engelsayac++;
}
delay(50);
bsond=b;
}



while(engelsayac==1&&c==0){
digitalWrite(sagmi,LOW);
digitalWrite(solmg,LOW);
analogWrite(sagmg,hiz);
analogWrite(solmi,hiz);


digitalWrite(trig1,LOW);
delayMicroseconds(2);
digitalWrite(trig1,HIGH);
delayMicroseconds(10); //SOLDAKİ MESAFE SENSORUNU OKUTTUK
digitalWrite(trig1,LOW);
int sure1 = pulseIn(echo1,HIGH);
int mesafe1 = (sure1/2) / 29.1;

if(mesafe1<32&&mesafe1>0){
c=1;
break;
}

}

if(mesafe1<17&&mesafe1>0&&(c==1||c==2)){
digitalWrite(sagmg,LOW);
digitalWrite(solmg,LOW);
analogWrite(sagmi,0);
analogWrite(solmi,hiz);

}


while(engelsayac==2&&c==1){ //Eğer ortadaki mesafe sensoru 25 ten büyükse ve ilk aşama bittiyse bu döngüye gir ve diğer komutlara bakma
digitalWrite(sagmg,LOW);
digitalWrite(solmi,LOW);
analogWrite(sagmi,hiz);
analogWrite(solmg,hiz); //Düz bir şekilde ilerle


digitalWrite(trig3,LOW);
delayMicroseconds(2);
digitalWrite(trig3,HIGH);
delayMicroseconds(10); //SAGDAKİ MESAFE SENSORUNU OKUTTUK
digitalWrite(trig3,LOW);
int sure3 = pulseIn(echo3,HIGH);
int mesafe3 = (sure3/2) / 29.1;

if(mesafe3<32&&mesafe3>0){
c=2;
break;
}

}

if(mesafe3<17&&mesafe3>0&&(c==1||c==2)){
digitalWrite(sagmg,LOW);
digitalWrite(solmg,LOW);
analogWrite(sagmi,hiz);
analogWrite(solmi,0);

}


while(sens2<200||sens3<200||sens4<200||sens5<200||sens6<200||sens7<200){

int position = qtra.readLine(sensorler,true,zemin); //1 siyah zemin 0 beyaz zemin


int hata = position - 2500;
int pid = Kp * hata + Kd * (hata - sonhata);
sonhata = hata;

int sagmotorhizi = hiz - pid;
int solmotorhizi = hiz + pid;



if (sagmotorhizi > maksimumhiz){
sagmotorhizi = maksimumhiz;
}
if (solmotorhizi > maksimumhiz ){
solmotorhizi = maksimumhiz;
}
if (sagmotorhizi < 0){
sagmotorhizi = 0;
}

if (solmotorhizi < 0){
solmotorhizi = 0;
}

digitalWrite(solmg,LOW);
digitalWrite(sagmg,LOW);
analogWrite(sagmi,sagmotorhizi);
analogWrite(solmi,solmotorhizi);


digitalWrite(trig2,LOW);
delayMicroseconds(2);
digitalWrite(trig2,HIGH); //ORTA SENSORU OKUTTUK
delayMicroseconds(10);
digitalWrite(trig2,LOW);
int sure2 = pulseIn(echo2,HIGH);
int mesafe2 = (sure2/2) / 29.1;


if(mesafe2<15&&mesafe2>0){
a=1;
break; //ORTA SENSOR 25 TEN KÜÇÜKSE ÇİZGİ İZLEYEN DÖNGÜSÜNDEN ÇIK
}

}

while(a==1){
digitalWrite(sagmi,LOW);
digitalWrite(solmg,LOW);
analogWrite(sagmg,hiz);
analogWrite(solmi,hiz);


digitalWrite(trig1,LOW);
delayMicroseconds(2);
digitalWrite(trig1,HIGH);
delayMicroseconds(10); //SOLDAKİ MESAFE SENSORUNU OKUTTUK
digitalWrite(trig1,LOW);
int sure1 = pulseIn(echo1,HIGH);
int mesafe1 = (sure1/2) / 29.1;

if(mesafe1<35&&mesafe1>0){
a=0;
break;
}

}


}

     
 
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.