NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <QTRSensors.h>

// QTR sensör nesnesi
QTRSensors qtr;

// Sensörlerin bağlı olduğu pinler
#define SENSOR_COUNT 8
#define SENSOR_PIN_1 A0
#define SENSOR_PIN_2 A1
#define SENSOR_PIN_3 A2
#define SENSOR_PIN_4 A3
#define SENSOR_PIN_5 A4
#define SENSOR_PIN_6 A5
#define SENSOR_PIN_7 A6
#define SENSOR_PIN_8 A7

// Motor sürücü pinleri
#define LEFT_MOTOR_PIN_1 2
#define LEFT_MOTOR_PIN_2 3
#define RIGHT_MOTOR_PIN_1 4
#define RIGHT_MOTOR_PIN_2 5

void setup() {
// Sensör pinlerini ayarla
unsigned int sensorPins[SENSOR_COUNT] = {SENSOR_PIN_1, SENSOR_PIN_2, SENSOR_PIN_3, SENSOR_PIN_4, SENSOR_PIN_5, SENSOR_PIN_6, SENSOR_PIN_7, SENSOR_PIN_8};
qtr.setTypeRC();
qtr.setSensorPins(sensorPins, SENSOR_COUNT);

// Motor pinlerini çıkış olarak ayarla
pinMode(LEFT_MOTOR_PIN_1, OUTPUT);
pinMode(LEFT_MOTOR_PIN_2, OUTPUT);
pinMode(RIGHT_MOTOR_PIN_1, OUTPUT);
pinMode(RIGHT_MOTOR_PIN_2, OUTPUT);
}

void loop() {
unsigned int sensorValues[SENSOR_COUNT];
qtr.read(sensorValues);

// Sensörlerin durumuna göre hareket et
if (sensorValues[0] > 500 && sensorValues[7] > 500) {
ileriGit();
} else if (sensorValues[0] < 500 && sensorValues[1] > 500) {
solaDon();
} else if (sensorValues[6] > 500 && sensorValues[7] < 500) {
sagaDon();
} else {
dur();
}
}

// İleri git fonksiyonu
void ileriGit() {
digitalWrite(LEFT_MOTOR_PIN_1, HIGH);
digitalWrite(LEFT_MOTOR_PIN_2, LOW);
digitalWrite(RIGHT_MOTOR_PIN_1, HIGH);
digitalWrite(RIGHT_MOTOR_PIN_2, LOW);
}

// Sola dön fonksiyonu
void solaDon() {
digitalWrite(LEFT_MOTOR_PIN_1, LOW);
digitalWrite(LEFT_MOTOR_PIN_2, HIGH);
digitalWrite(RIGHT_MOTOR_PIN_1, HIGH);
digitalWrite(RIGHT_MOTOR_PIN_2, LOW);
}

// Sağa dön fonksiyonu
void sagaDon() {
digitalWrite(LEFT_MOTOR_PIN_1, HIGH);
digitalWrite(LEFT_MOTOR_PIN_2, LOW);
digitalWrite(RIGHT_MOTOR_PIN_1, LOW);
digitalWrite(RIGHT_MOTOR_PIN_2, HIGH);
}

// Dur fonksiyonu
void dur() {
digitalWrite(LEFT_MOTOR_PIN_1, LOW);
digitalWrite(LEFT_MOTOR_PIN_2, LOW);
digitalWrite(RIGHT_MOTOR_PIN_1, LOW);
digitalWrite(RIGHT_MOTOR_PIN_2, LOW);
}
     
 
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.