Last active
August 29, 2015 14:24
-
-
Save cagbal/43aa699e54656f129f4e to your computer and use it in GitHub Desktop.
QTR-8RC Kullanım Örneği
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while(1) // sonsuz döngü açıyoruz | |
| { | |
| digitalOutput(Pin0,Pin1,Pin2,Pin3,Pin4,Pin5,Pin6,Pin7); // Pinlerin hepsini output yapıyoruz. | |
| digitalHIGH(Pin0,Pin1,Pin2,Pin3,Pin4,Pin5,Pin6,Pin7); // Bütün pinleri HIGH yapıyoruz. | |
| Delay_us(10); // 10 mikro saniye sensörün kapasitörünün dolmasını bekliyoruz. | |
| digitalInput( Pin0,Pin1,Pin2,Pin3,Pin4,Pin5,Pin6,Pin7); // Pinlerin hepisni input yapıyoruz. | |
| // 20 milisaniye bekliyoruz bu kısım tecrübeyle ve deneme yanılma ile oluyor. | |
| //20'yi test ederek geliştirebilirsiniz. | |
| Delay_ms(20); | |
| for(int i=0; i<8; i++) | |
| { | |
| // Bu döngüde tek tek pinlere bakıyoruz eğer pin HIGH ise yansıma yok demektir. | |
| // Eğer LOW ise yansımayı yani beyaz cismi algıladınız demektir. | |
| if(Pin(i) == 0) | |
| { | |
| // Bu kısımda yapılacaklar size kalmış. | |
| ... | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment