Notes
Notes - notes.io |
float i = 0.0; // hız ve segmentleri ayarlayan değişken
// Numaraların olduğu tablo
byte sayilar [10]={B00111111, B00000110, B01011011, B01001111, B01100110,
B01101101, B01111101, B00000111, B01111111, B01101111 };
// Bitmap'leri byte'a çevirmek için B ifadesiyle yazıldı
int yukari=1; // yukarı butonu
int asagi=1; // aşağı butonu
int status = 0; // hangi butona basıldğının kontrolü
int stopS = 0; // Durdurma butoınnu kontrolü
void setup() {
// pinMode OUTPUT to digital pins from 0 to 7
DDRD = B11111111; // 0 - 7 pinler arasını yakmak
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,INPUT);
pinMode(11,INPUT);
pinMode(12,INPUT);
DDRB = B11110011; // 6. ve DP alanlarına LOW akımı iletmek
}
void loop() {
yukari=digitalRead (10);
asagi=digitalRead (11);
stopS = digitalRead(12);
int potYon = analogRead(0);
float potHiz = (float)analogRead(1)/8000; // 0 - 0.13 arası
// bir float değer alınması
if(stopS == 1){ // durdurma butonuna basıldıysa status = 0
if(press % 2 == 0){status = 0;}
else{
// ikinci kez basıldıysa potansiyometre veya butona göre devam
if((yukari==HIGH) || potYon < 1024 && potYon > 512){// && (upbefore==0)){
status = 1;
}
if((asagi==HIGH) || potYon < 512 && potYon > 0 ){
status = 2;
}
}
press++; // butona basılma sayısını artırma
//status = 0;
}
// yukarı butonuna basılma kontrolü
if(yukari==HIGH || ( potYon < 1024 && potYon > 512 && status != 0) ){// && (upbefore==0)){
status = 1;
}
if(status == 1 ){
if(i<99){
i = i + potHiz; // potansiyometre sonda ise i 0.13'er artar
if(i==99)
i=1;
}
}
// aşağı butonuna basılma kontrolü
if(asagi==HIGH || ( potYon < 512 && potYon > 0 && status != 0)){
status = 2;
}
if(status == 2 ){
if (i>0)
i = i - potHiz;
}
o=i/10; // onlar basamağı i değerinin 10 a bölüm sonucunun integer hali
b=i-(o*10); // birler basamağı onlar basamağı değerinin sonuçtan çıkarılması
// i => 13.13 ise d => 1 && u => 13.13 - 10 = 3
//önce onlar basamağinın displayine d değerini basar
digitalWrite(9,LOW);
digitalWrite(8,HIGH);
PORTD=sayilar[o];
delay(20); // 20 ms gecikme
// print units
digitalWrite(8,LOW); // Birler basamağının segmentine u değerini basar
digitalWrite(9,HIGH);
PORTD= sayilar[b]; // PORTD Arduino üzerindeki 0 - 7 digital pinleri
delay(20);
}
|
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