Notes
![]() ![]() Notes - notes.io |
int echo = 3; // Ultrasonik sensör üzerindeki echo pini
int buz = 5; // Buzzer pinini belirledik.
#define R 10
#define G 8
#define B 9
int sure; // sure adı altında bir değişken oluşturduk.
float mesafe; // mesafe değişkeni
void setup() {
pinMode(buz, OUTPUT); // Buzzer çıkışını verdik.
pinMode(trig, OUTPUT); // Trig pini çıkış verdik.
pinMode(echo, INPUT); // Echo pinine giriş verdik.
pinMode(R, OUTPUT); // RGB Led Kırmızı Çıkış verdik.
pinMode(G, OUTPUT); // *Yeşil
pinMode(B, OUTPUT); // * Mavi
Serial.begin(9600); // Seri port çizici
}
void loop() {
digitalWrite(trig, HIGH); // Ultrasonik sensör(trig) çalıştır.
delayMicroseconds(1000); // 1 saniye bekle
digitalWrite(trig, LOW); // Ultrasonik sensör(trig) durdur.
sure = pulseIn(echo, HIGH);
mesafe = (sure / 2) / 29.1; // Mesafeyi bul.
if (mesafe <= 10) // 10 cm ve altındaki cisimler
{
Serial.println("-----------------------------");
Serial.println(mesafe);
Serial.println("metre");
Serial.println("-----------------------------");
digitalWrite(R, HIGH); // Kırmızı Ledi Yak.
analogWrite(buz, 127); // Buzzer Çalıştır.
delay(100);
analogWrite(buz, 0); // Buzzer durdur.
digitalWrite(R, LOW); // Kırmızı Led Söndür.
delay(10);
}
else if (mesafe <= 25) // 25 cm ve altında
{
Serial.println("-----------------------------");
Serial.println(mesafe);
Serial.println("metre");
Serial.println("-----------------------------");
digitalWrite(B, HIGH); // Mavi led.
analogWrite(buz, 127);
delay(100);
analogWrite(buz, 0);
digitalWrite(B, LOW);
delay(500);
}
else if (mesafe <= 50) // 50 cm ve altında
{
Serial.println("-----------------------------");
Serial.println(mesafe);
Serial.println("metre");
Serial.println("-----------------------------");
digitalWrite(G, HIGH); // Yeşil Led
analogWrite(buz, 127);
delay(250);
analogWrite(buz, 0);
digitalWrite(G, LOW);
delay(750);
}
else // 50 cm ve üstünde
{
Serial.println(mesafe);
digitalWrite(G, HIGH); // Yeşil Led
digitalWrite(R, HIGH);
delay(50);
digitalWrite(G, LOW);
digitalWrite(R, LOW);
delay(1500);
}
}
![]() |
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