NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

[07/06 19:05] Emre Plato: http://www.robimek.com/wp-content/uploads/cizgi-izleyen-robot-1.zip
[07/06 19:05] Emre Plato: buna tıklar tıklamaz indiricek
[07/06 19:05] Emre Plato: bundan kütüphaneleri kurucaksınız
[07/06 19:06] Emre Plato: #include <QTRSensors.h>
#define SolMotorileri 9
#define SolMotorGeri 10
#define SagMotorileri 11
#define SagMotorGeri 12
#define ena 4
#define enb 5

#define KP .2
#define KD 5
#define M1_minumum_hiz 120
#define M2_minumum_hiz 120
#define M1_maksimum_hiz 210
#define M2_maksimum_hiz 210
#define MIDDLE_SENSOR 3
#define NUM_SENSORS 5
#define TIMEOUT 2500
#define EMITTER_PIN 2
#define DEBUG 0
int lastError = 0;
int last_proportional = 0;
int integral = 0;
QTRSensorsRC qtrrc((unsigned char[]) { 19,18,17,16,15} ,NUM_SENSORS, TIMEOUT, EMITTER_PIN);

unsigned int sensorValues[NUM_SENSORS];

void setup() {
pinMode(SolMotorileri,OUTPUT);
pinMode(SolMotorGeri,OUTPUT);
pinMode(SagMotorileri,OUTPUT);
pinMode(SagMotorGeri,OUTPUT);
pinMode(ena,OUTPUT);
pinMode(enb,OUTPUT);
delay(1500);
manual_calibration();
set_motors(0,0);

}

void loop() {
unsigned int sensors[5];
int position = qtrrc.readLine(sensors);
int error = position - 2000;

int motorSpeed = KP * error + KD * (error - lastError);
lastError = error;

int leftMotorSpeed = M1_minumum_hiz + motorSpeed;
int rightMotorSpeed = M2_minumum_hiz - motorSpeed;

set_motors(leftMotorSpeed, rightMotorSpeed);

}

void set_motors(int motor1speed, int motor2speed)
{
if (motor1speed > M1_maksimum_hiz ) motor1speed = M1_maksimum_hiz; //MAKSİMUM MOTOR 1 HIZ LİMİTİ
if (motor2speed > M2_maksimum_hiz ) motor2speed = M2_maksimum_hiz; // MAKSİMUM MOTOR 2 HIZ LİMİTİ
if (motor1speed < 0) motor1speed = 0; // MİNIMUMMOTOER 1 HIZ LİMİTİ
if (motor2speed < 0) motor2speed = 0; // MİNİMUM MOTOR 2 HIZ LİMİTİ
analogWrite(ena,motor1speed);
analogWrite(enb,motor2speed);
digitalWrite(SolMotorileri,HIGH);
digitalWrite(SagMotorileri,HIGH);
digitalWrite(SolMotorGeri,LOW);
digitalWrite(SagMotorGeri,LOW);

}

void manual_calibration() {

int i;
for (i = 0; i < 250; i++)
{
qtrrc.calibrate(QTR_EMITTERS_ON);
delay(20);
}

if (DEBUG) {
Serial.begin(9600);
for (int i = 0; i < NUM_SENSORS; i++)
{
Serial.print(qtrrc.calibratedMinimumOn[i]);
Serial.print(' ');
}
Serial.println();

for (int i = 0; i < NUM_SENSORS; i++)
{
Serial.print(qtrrc.calibratedMaximumOn[i]);
Serial.print(' ');
}
Serial.println();
Serial.println();
}
}
[07/06 19:06] Emre Plato: bu kodları
[07/06 19:07] Emre Plato: int trigPin=4;
int echoPin=3;
int olcum;
int cm;

void setup()
{
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(trigPin,LOW);
delayMicroseconds(10);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
olcum=pulseIn(echoPin,HIGH);
cm=olcum/58;
if(cm<0)
{
Serial.println("Veri Hatalı");
}
else
{
if(cm>16)
{
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
Serial.println("Dönüyor");
}
else
{
digitalWrite(12,LOW);
digitalWrite(13,LOW);
Serial.println("Dönmüyor");
}
Serial.print("cm:");
Serial.println(cm);
delay(500);

}
}
[07/06 19:07] Emre Plato: buda sensör kodu
[07/06 19:08] Emre Plato: çizgi izleme http://notes.io/sR4U
[07/06 19:09] Emre Plato: buda kütüphanlerin olduğu link http://notes.io/sR4T
     
 
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.