Notes
Notes - notes.io |
#include <SoftwareSerial.h> // Seri haberleşme kütüphanesi
char parola[]="5678";
char parola2[]="2345";
char kod[4];
int cont=0;
float deger,sicaklik;
SoftwareSerial mySerial(0, 1); // Seri haberleşme başlatıldı
const byte ROWS = 4; // Keypad satırları
const byte COLS = 4; // Keypad sütunları
char keys[ROWS][COLS] =
{
{'1','2','3','A'},
{'4','5','6','B'}, // Tuş takımı
{'7','8','9','C'},
{'*','0','#','D'}
};
// Satır ve sütun pinleri
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
Keypad customKeypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS); // Keypad nesnesi ve tuş takımı oluşturuldu
void setup()
{
//Giriş ve çıkoş pinleri
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
mySerial.begin(9600);
}
void loop()
{
deger=analogRead(0); // data bacagındaki veriyi okuduk
deger=(deger/1023)*5000; // degeri mV 'a dönüştürecek
sicaklik=deger/10,0; // sıcaklık başına 10mV üreteceği ifade
if(sicaklik > 90 ) {
digitalWrite(13,HIGH);
}
else{
digitalWrite(13,LOW);
}
char customKey = customKeypad.getKey(); // Keypad'den gelen değer okundu ve customKey değişkenine atandı
if (customKey != NO_KEY) // Eğer bir tuşa basıldıysa
{
kod[cont]=customKey; // 4 uzunluktaki dizinin ilk değerine bu değer atandı
mySerial.write(kod[cont]); // Girilen değer ikinci arduino'ya aktarıldı
cont=cont+1; // sayaç 1 artırıldı
if(cont==4) // Eğer 4 adet rakam girildiyse parola kontrolü yapıldı
{
if(kod[0]==parola[0]&&kod[1]==parola[1]&&kod[2]==parola[2]&&kod[3]==parola[3])
{ // Eğer ilk parola girildiyse 11 nolu pindeki ledi yak ( Ortadaki )
digitalWrite(10,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
}
else if(kod[0]==parola2[0]&&kod[1]==parola2[1]&&kod[2]==parola2[2]&&kod[3]==parola2[3])
{ // Eğer ilk parola girildiyse 12 nolu pindeki ledi yak ( Sondaki )
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
}
else
{ // Parola yanlış ise 10 nolu pindeki ledi yak ( İlk Led )
digitalWrite(11,LOW);
digitalWrite(12,LOW);
digitalWrite(10,HIGH);
}
cont=0; // Tekrar parola girişi için sayacı sıfırla
}
}
}
|
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