├── 01 - Giriş ├── 1-Breadboard │ └── horizontal-rows.png ├── 2-Direnç │ └── renk_kodu.gif ├── 3-Gerilim Bölücü │ └── gerilim bölücü.docx ├── 4-Arduino Pinleri │ ├── Arduino-uno.png │ ├── ArduinoDiecimilaComponents.jpg │ └── uno4.jpg ├── 5-Arduino IDE │ └── Notlar.md ├── Arduino Eğitim (YTÜ) 1.pptx ├── Arduino Eğitim (YTÜ) 2.pptx └── Notlar.md ├── 02 - LED ├── Blink │ └── Blink.ino ├── Cakar │ ├── cakar.ino │ ├── Çakar Devresi.fzz │ └── Çakar Devresi.jpg ├── LED-Pin-Outs1.png └── Notlar.md ├── 03 - Transistor LED ├── BC237.jpg ├── Notlar.md ├── Transistor │ ├── Transistor.fzz │ ├── Transistor.ino │ └── Transistor.jpg └── npn-pnp-transistors.png ├── 04 - Button LED ├── Buton_Deger_Okuma │ ├── Buton_Deger_Okuma.ino │ ├── Button.fzz │ └── button.jpg ├── Buton_LED │ ├── Buton_LED.ino │ ├── Button_LED.fzz │ └── Button_LED.jpg ├── Buton_LED_2 │ ├── Buton_LED_2.ino │ └── ledvoltajes.jpg ├── Notlar.md ├── debouncing │ └── debouncing.ino └── led_voltages.jpg ├── 05 - 7805 Reg ├── 0359-1.jpg ├── 7805_fritzing.jpg ├── L7805CD2T_to_L7885CV.pdf └── Notlar.md ├── 06 - Analog Okuma - Potans ├── Analog Sinyal Okuma.docx ├── Potans_Deger_Okuma │ ├── Potans_Deger_Okuma.fzz │ ├── Potans_Deger_Okuma.ino │ └── Potans_Deger_Okuma.jpg └── Voltmetre │ └── Voltmetre.ino ├── 07 - RGB Led ├── Notlar.md ├── rgb_led_1 │ ├── RGB_LED.fzz │ ├── RGB_LED.jpg │ └── rgb_led_1.ino ├── rgb_led_2 │ └── rgb_led_2.ino ├── rgb_led_3 │ ├── RGB_LED2.fzz │ ├── RGB_LED2.jpg │ └── rgb_led_3.ino └── rgb_led_picture.png ├── 09 - LDR ├── Arduino_LDR │ ├── Arduino_LDR.ino │ ├── LDR.fzz │ └── LDR.jpg └── Notlar.md ├── 10 - Buzzer ├── Buzzer.fzz ├── Buzzer.jpg ├── Ezel │ └── music │ │ └── music.ino ├── Mario │ └── Mario.ino ├── Playtunes │ ├── Playtune.cpp │ └── Playtune.h └── Star_Wars │ └── Star_Wars.ino ├── 11 - 7 Segment ├── 7_segment_sema_baglanti.bmp ├── Yedi-Segment-Potans │ ├── Yedi-Segment-Potans.ino │ ├── Yedi_Segment_Potans.fzz │ └── Yedi_Segment_Potans.jpg ├── Yedi-Segment-Sayac │ ├── Yedi-Segment-Sayac.fzz │ ├── Yedi-Segment-Sayac.ino │ └── Yedi-Segment-Sayac.jpg └── Yedi-Segment │ ├── Yedi-Segment.ino │ ├── Yedi_Segment.fzz │ └── Yedi_Segment.jpg ├── 12 - LM35 ├── lm 35 kodu.docx ├── lm35-cizim.gif └── lm35 │ └── lm35.ino ├── 13 - HC SR04 ├── DeepinScreenshot20160129010922.png ├── HCR04 │ └── HCR04.ino └── hc sr04 - led.docx ├── 14 - Kızılötesi Sensör ├── CNY70 │ └── CNY70.ino ├── cny.png └── cny70.odt ├── 15 - Kendi Ardunomuzu Yapalım ├── atmega.png ├── atmega328p.png ├── bootloader.odt ├── bootloader2.png ├── breadboard-arduino.jpg └── programming.odt ├── 16 - Haberleşme Protokolleri ├── Arduino_Haberlesme1 │ └── Arduino_Haberlesme1.ino ├── Arduino_Haberlesme2 │ └── Arduino_Haberlesme2.ino └── haberleşme protokolleri.odt ├── 17 - Motor Uygulama ├── L293D-with-motors.png └── motor │ └── motor.ino ├── BONUS - Scratch Uygulamaları ├── 01 - Scratch Program Tanıtımı.pdf ├── 02 - Tübitak Scratch Kitabı.pdf ├── 03 - Scratch ile Arduino Programlama.pdf ├── 04 - Scratch Kısa Notlar.pdf └── Scratch Uygulamalar │ ├── 23NİSAN.sb │ ├── HOKEY.sb │ ├── LABİRENT_SINAV.sb │ ├── Oyun_ZOR_.sb │ ├── balıklar Hareket kodları.sb │ ├── cizim yap.sb │ ├── damga.sb │ ├── emoji oyunu.sb │ ├── ilk_KODlarımız.sb │ ├── karakterini çiz.sb │ ├── pacman.sb │ ├── top oyunu.sb │ ├── zor oyunu.sb │ └── çarpma işlemi.sb ├── LICENSE └── README.md /01 - Giriş/1-Breadboard/horizontal-rows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/1-Breadboard/horizontal-rows.png -------------------------------------------------------------------------------- /01 - Giriş/2-Direnç/renk_kodu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/2-Direnç/renk_kodu.gif -------------------------------------------------------------------------------- /01 - Giriş/3-Gerilim Bölücü/gerilim bölücü.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/3-Gerilim Bölücü/gerilim bölücü.docx -------------------------------------------------------------------------------- /01 - Giriş/4-Arduino Pinleri/Arduino-uno.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/4-Arduino Pinleri/Arduino-uno.png -------------------------------------------------------------------------------- /01 - Giriş/4-Arduino Pinleri/ArduinoDiecimilaComponents.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/4-Arduino Pinleri/ArduinoDiecimilaComponents.jpg -------------------------------------------------------------------------------- /01 - Giriş/4-Arduino Pinleri/uno4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/4-Arduino Pinleri/uno4.jpg -------------------------------------------------------------------------------- /01 - Giriş/5-Arduino IDE/Notlar.md: -------------------------------------------------------------------------------- 1 | ## Arduino IDE 2 | 3 | - Setup ve Loop fonksiyonları 4 | - Bu fonksiyonlarda tanımlanacak değerler 5 | - Pin tanımlamaları ve global değişkenlerin Setup fonksiyonlarının üstünde yapılması 6 | 7 | ## Genel Fonksiyonlar 8 | 9 | - pinMode( *pin*, *INPUT/OUTPUT* ) 10 | 11 | - digitalWrite( *pin*, *HIGH/LOW* ) 12 | - digitalRead( *pin* ) 13 | 14 | - analogWrite( *pin*, *0-255* ) 15 | - analogRead( *pin* ) # Alınacak değerler 0-1023 arası -------------------------------------------------------------------------------- /01 - Giriş/Arduino Eğitim (YTÜ) 1.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/Arduino Eğitim (YTÜ) 1.pptx -------------------------------------------------------------------------------- /01 - Giriş/Arduino Eğitim (YTÜ) 2.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/01 - Giriş/Arduino Eğitim (YTÜ) 2.pptx -------------------------------------------------------------------------------- /01 - Giriş/Notlar.md: -------------------------------------------------------------------------------- 1 | ## Arduino Giriş 2 | 3 | - Temel elektronik bilgisi 4 | - Arduino Slayt - 1 5 | - Kapalı devre tasarımı ve Arduino'da kapalı devre tasarımı nasıl yapılır? 6 | - 5V ve GRD kavramları 7 | - Kontrol pinleri ve 5V-GRD arasındaki farklar 8 | - Kontrol pinleri ile devre nasıl kontrol edilir? 9 | - Arduino kullanmamızdaki amaç 10 | - Inputlar ve Outputlar arasında kodlar ile ilişki kurma -------------------------------------------------------------------------------- /02 - LED/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | int pin = 13; 2 | 3 | void setup() { 4 | 5 | pinMode(pin, OUTPUT); 6 | 7 | } 8 | 9 | void loop() { 10 | 11 | digitalWrite(pin, HIGH); 12 | delay(1000); 13 | 14 | digitalWrite(pin, LOW); 15 | delay(1000); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /02 - LED/Cakar/cakar.ino: -------------------------------------------------------------------------------- 1 | int pin1 = 12; 2 | int pin2 = 13 3 | 4 | void setup() { 5 | pinMode(pin1, OUTPUT); 6 | pinMode(pin2, OUTPUT); 7 | } 8 | 9 | void loop() { 10 | digitalWrite(pin1, HIGH); 11 | digitalWrite(pin2, LOW); 12 | delay(1000); 13 | 14 | digitalWrite(pin1, LOW); 15 | digitalWrite(pin2, HIGH); 16 | delay(1000); 17 | } 18 | -------------------------------------------------------------------------------- /02 - LED/Cakar/Çakar Devresi.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/02 - LED/Cakar/Çakar Devresi.fzz -------------------------------------------------------------------------------- /02 - LED/Cakar/Çakar Devresi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/02 - LED/Cakar/Çakar Devresi.jpg -------------------------------------------------------------------------------- /02 - LED/LED-Pin-Outs1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/02 - LED/LED-Pin-Outs1.png -------------------------------------------------------------------------------- /02 - LED/Notlar.md: -------------------------------------------------------------------------------- 1 | ## LED 2 | 3 | - LED kavramı nedir? 4 | - Dirençsiz Led bağlama uygulamaları 5 | - LED'i pozitif ve neagatif kutbundan kontrol ettiğimizde, HIGH ve LOW durumlarına verdiği yanıtlar 6 | - Ledleri dirençle bağlamanın önemi 7 | - Dirençle led bağlama uygulamaları 8 | - Çakar Devresi 9 | - Bir ve birden fazla led bağlayarak uygulamalar yapma -------------------------------------------------------------------------------- /03 - Transistor LED/BC237.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/03 - Transistor LED/BC237.jpg -------------------------------------------------------------------------------- /03 - Transistor LED/Notlar.md: -------------------------------------------------------------------------------- 1 | ## Transistor 2 | 3 | - Transistor çalışma prensibi 4 | - Transistor ile led sürme 5 | 6 | ## Transistörlerin Yapısı ve Çalışması 7 | 8 | Transistörler NPN veya PNP biçiminde yerleştirilmiş üç yarı iletken maddenin bileşiminden oluşmaktadır. Beyz kutbu tetiklendiği zaman kollektör ve emiter arasında direnç değeri azalır ve akım geçirir hale gelir. Kollektör ve emiter arasından geçen akımın miktarı beyz kutbuna uygulanan akımın miktarına bağlıdır. 9 | 10 | ## NPN Tipi Transistörler 11 | 12 | NPN tipi transistörlerin yapısı iki N tipi yarı iletken madde arasına ince bir katman halinde yerleştirilmiş P tipi yarı iletken beyz maddesinden oluşmaktadır. İki N tipi madde arasındaki beyz tabakası elektron geçişini kontrol etme görevi yapmaktadır. Transistörler geçen akımı denetleyerek küçük akımları büyütebilir ya da küçük bir akım ile büyük bir alıcının çalışmasını sağlayabilir. 13 | 14 | NPN tipi transistörlerde yandaki resimde görüldüğü gibi VBB kaynağının artı ucu beyz kutbunu pozitif yüklerken Vcc kaynağının eksi ucu ise emiter kutbundaki elektronları yukarı iter. Sıkışan elektronlar beyz tarafından çekilir. Yani, emiterin iletim bandındaki elektronlar E-B gerilim setini aşarak beyz bölgesine girerler, ancak beyz bölgesi dar olduğundan emiter bölgesinden gelen elektronların yaklaşık %2 si beyz bölgesi tarafından çekilirken kalan %98 i kollektöre geçer. Vcc kaynağının artı ucu elektronları kollektör bölgesine doğru çeker ve böylece elektron akışı sürekli hale gelir ve VBB kaynağının verdiği beyz akımı sürdükçe emiterden kollektöre elektron akışı devam eder.NPN tipi transistörlerde elektronlar yukarı, oyuklar ise aşağı doğru gider ve bu nedenle beyze uygulanan artı sinyal kollektörden emitere doğru akım geçirir denir. Emiter akımı beyz ve kollektör akımlarının toplamına eşittir. 15 | 16 | ## PNP Tipi Transistörler 17 | 18 | PNP tipi transistörlerin yapısı da NPN tipi transistörler gibidir. Tek fark bu kez P tipi iki yarı iletken madde arasına ince bir tabaka halinde N tipi yarı iletken maddenin yerleştirilmiş olmasıdır. 19 | 20 | PNP tipi transistörlerde VBB kaynağının eksi ucu beyz kutbunu negatif yüklerken Vcc kaynağının artı ucu da emiter bölgesindeki artı yüklü oyukları yukarı iter. Bu şekilde sıkışan artı yükler beyz tarafından çekilip buradan kollektör bölgesine geçerler. Vcc kaynağının eksi ucu kollektör bölgesindeki oyukları kendine çektiğinden dolayı oyuk hareketi süreklilik kazanır. VBB akımı sürdükçe emiterden kollektöre doğru bu hareket sürer.PNP tipi transistörlerde elektronlar aşağı, oyuklar ise yukarı doğru gider ve bu nedenle beyze uygulanan eksi sinyal emiterden kollektöre doğru akım geçirir denir. -------------------------------------------------------------------------------- /03 - Transistor LED/Transistor/Transistor.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/03 - Transistor LED/Transistor/Transistor.fzz -------------------------------------------------------------------------------- /03 - Transistor LED/Transistor/Transistor.ino: -------------------------------------------------------------------------------- 1 | int pin = 8; 2 | 3 | void setup() { 4 | pinMode(pin, OUTPUT); 5 | } 6 | 7 | void loop() { 8 | digitalWrite(pin, HIGH); 9 | delay(1000); 10 | 11 | digitalWrite(pin, LOW); 12 | delay(1000); 13 | } 14 | -------------------------------------------------------------------------------- /03 - Transistor LED/Transistor/Transistor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/03 - Transistor LED/Transistor/Transistor.jpg -------------------------------------------------------------------------------- /03 - Transistor LED/npn-pnp-transistors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/03 - Transistor LED/npn-pnp-transistors.png -------------------------------------------------------------------------------- /04 - Button LED/Buton_Deger_Okuma/Buton_Deger_Okuma.ino: -------------------------------------------------------------------------------- 1 | int pin = A0; 2 | int sayac = 0; 3 | 4 | void setup() { 5 | pinMode(pin, INPUT); 6 | Serial.begin(9600); 7 | } 8 | 9 | void loop() { 10 | int gelenDeger = digitalRead(pin); 11 | if(gelenDeger == HIGH) { 12 | sayac++; 13 | } 14 | Serial.println(sayac); 15 | delay(20); 16 | } 17 | -------------------------------------------------------------------------------- /04 - Button LED/Buton_Deger_Okuma/Button.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/04 - Button LED/Buton_Deger_Okuma/Button.fzz -------------------------------------------------------------------------------- /04 - Button LED/Buton_Deger_Okuma/button.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/04 - Button LED/Buton_Deger_Okuma/button.jpg -------------------------------------------------------------------------------- /04 - Button LED/Buton_LED/Buton_LED.ino: -------------------------------------------------------------------------------- 1 | int pin = A0; 2 | int led = 8; 3 | 4 | void setup() { 5 | pinMode(pin, INPUT); 6 | pinMode(led, OUTPUT); 7 | } 8 | 9 | void loop() { 10 | int gelenDeger = analogRead(pin); 11 | int ledDrurum = digitalRead(led); 12 | if(gelenDeger == HIGH) { 13 | digitalWrite(led, !ledDrurum); 14 | } 15 | delay(200); 16 | } 17 | -------------------------------------------------------------------------------- /04 - Button LED/Buton_LED/Button_LED.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/04 - Button LED/Buton_LED/Button_LED.fzz -------------------------------------------------------------------------------- /04 - Button LED/Buton_LED/Button_LED.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/04 - Button LED/Buton_LED/Button_LED.jpg -------------------------------------------------------------------------------- /04 - Button LED/Buton_LED_2/Buton_LED_2.ino: -------------------------------------------------------------------------------- 1 | int buton = 9; 2 | int led = 13; 3 | 4 | void setup() { 5 | pinMode(led, OUTPUT); 6 | pinMode(buton, INPUT); 7 | } 8 | 9 | void loop() { 10 | int butonDurumu = digitalRead(buton); 11 | if (butonDurumu == HIGH) { 12 | digitalWrite(led, HIGH); 13 | } 14 | else { 15 | digitalWrite(led, LOW); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /04 - Button LED/Buton_LED_2/ledvoltajes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/04 - Button LED/Buton_LED_2/ledvoltajes.jpg -------------------------------------------------------------------------------- /04 - Button LED/Notlar.md: -------------------------------------------------------------------------------- 1 | ## Button LED 2 | 3 | - Serial haberleşme 4 | - Buttondan değer okuma ve serial üzerinde gösterme 5 | - Buton durumuna göre led yakıp söndürme -------------------------------------------------------------------------------- /04 - Button LED/debouncing/debouncing.ino: -------------------------------------------------------------------------------- 1 | boolean ledDurum = LOW; 2 | 3 | void setup() { 4 | pinMode(2, INPUT); 5 | pinMode(13, OUTPUT); 6 | Serial.begin(9600); 7 | } 8 | 9 | void loop() { 10 | boolean butonDurum = digitalRead(2); 11 | if (butonDurum == LOW) { 12 | ledDurum = !ledDurum; 13 | delay(20); 14 | while (!digitalRead(2)) { 15 | delay(20); 16 | } 17 | } 18 | digitalWrite(13, ledDurum); 19 | Serial.println(butonDurum); 20 | } 21 | -------------------------------------------------------------------------------- /04 - Button LED/led_voltages.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/04 - Button LED/led_voltages.jpg -------------------------------------------------------------------------------- /05 - 7805 Reg/0359-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/05 - 7805 Reg/0359-1.jpg -------------------------------------------------------------------------------- /05 - 7805 Reg/7805_fritzing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/05 - 7805 Reg/7805_fritzing.jpg -------------------------------------------------------------------------------- /05 - 7805 Reg/L7805CD2T_to_L7885CV.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/05 - 7805 Reg/L7805CD2T_to_L7885CV.pdf -------------------------------------------------------------------------------- /05 - 7805 Reg/Notlar.md: -------------------------------------------------------------------------------- 1 | ## 7805 Regülator 2 | 3 | - 7805 Özellikleri 4 | - Datasheet kavramı ve datasheet arama -------------------------------------------------------------------------------- /06 - Analog Okuma - Potans/Analog Sinyal Okuma.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/06 - Analog Okuma - Potans/Analog Sinyal Okuma.docx -------------------------------------------------------------------------------- /06 - Analog Okuma - Potans/Potans_Deger_Okuma/Potans_Deger_Okuma.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/06 - Analog Okuma - Potans/Potans_Deger_Okuma/Potans_Deger_Okuma.fzz -------------------------------------------------------------------------------- /06 - Analog Okuma - Potans/Potans_Deger_Okuma/Potans_Deger_Okuma.ino: -------------------------------------------------------------------------------- 1 | int pin = A0; 2 | 3 | void setup() { 4 | Serial.begin(9600); 5 | } 6 | 7 | void loop() { 8 | int sensorDegeri = analogRead(pin); 9 | Serial.println(sensorDegeri); 10 | delay(10); 11 | } -------------------------------------------------------------------------------- /06 - Analog Okuma - Potans/Potans_Deger_Okuma/Potans_Deger_Okuma.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/06 - Analog Okuma - Potans/Potans_Deger_Okuma/Potans_Deger_Okuma.jpg -------------------------------------------------------------------------------- /06 - Analog Okuma - Potans/Voltmetre/Voltmetre.ino: -------------------------------------------------------------------------------- 1 | void setup() { 2 | Serial.begin(9600); 3 | } 4 | void loop() { 5 | int sensorDegeri = analogRead(A0); /* A0’daki gerilimin sayısal değeri */ 6 | float gerilim = ((float)5/1023)*sensorDegeri; 7 | /* 8 | 5 volt 1023 ile ölçülüyordu. 9 | Bu yüzden adim aralığını bulmak için 5/1023 kesrini bulduk. 10 | Bu kesir okunan ADC değeri ile çarpılmıştır. 11 | Böylece gerilim değeri bulunmuştur. 12 | */ 13 | Serial.print(gerilim);/* bulunan gerilim değeri bilgisayara aktarıldı. */ 14 | Serial.println(" Volt"); 15 | delay(100); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /07 - RGB Led/Notlar.md: -------------------------------------------------------------------------------- 1 | ## RGB LED 2 | 3 | - RGB Led pinleri 4 | - Anode pinini + ya bağladığımız için diğer pinler için 0 değeri max, 255 değeri min olur. -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_1/RGB_LED.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/07 - RGB Led/rgb_led_1/RGB_LED.fzz -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_1/RGB_LED.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/07 - RGB Led/rgb_led_1/RGB_LED.jpg -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_1/rgb_led_1.ino: -------------------------------------------------------------------------------- 1 | byte led_blue=3; 2 | byte led_green=5; 3 | byte led_red=6; 4 | unsigned int t=1000; 5 | 6 | void setup() { 7 | pinMode(led_red,OUTPUT); 8 | pinMode(led_green,OUTPUT); 9 | pinMode(led_blue,OUTPUT); 10 | } 11 | 12 | void loop() { 13 | analogWrite(led_red, 0); 14 | analogWrite(led_green, 255); 15 | analogWrite(led_blue, 255); 16 | delay(t); 17 | 18 | analogWrite(led_red, 255); 19 | analogWrite(led_green, 0); 20 | analogWrite(led_blue, 255); 21 | delay(t); 22 | 23 | analogWrite(led_red, 255); 24 | analogWrite(led_green, 255); 25 | analogWrite(led_blue, 0); 26 | delay(t); 27 | } 28 | -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_2/rgb_led_2.ino: -------------------------------------------------------------------------------- 1 | byte led_blue = 3; 2 | byte led_green = 5; 3 | byte led_red = 6; 4 | int t = 50; 5 | 6 | void setup() { 7 | pinMode(led_red, OUTPUT); 8 | pinMode(led_green, OUTPUT); 9 | pinMode(led_blue, OUTPUT); 10 | } 11 | void loop() { 12 | for (int i = 255; i > -1; i++) 13 | { 14 | analogWrite(led_red, i); 15 | delay(t); 16 | } 17 | for (int i = 255; i > -1; i++) 18 | { 19 | analogWrite(led_green, i); 20 | delay(t); 21 | } 22 | for (int i = 255; i > -1; i++) 23 | { 24 | analogWrite(led_blue, i); 25 | delay(t); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_3/RGB_LED2.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/07 - RGB Led/rgb_led_3/RGB_LED2.fzz -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_3/RGB_LED2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/07 - RGB Led/rgb_led_3/RGB_LED2.jpg -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_3/rgb_led_3.ino: -------------------------------------------------------------------------------- 1 | 2 | byte led_blue=11; 3 | byte led_green=10; 4 | byte led_red=9; 5 | 6 | void setup() { 7 | pinMode(led_red,OUTPUT); 8 | pinMode(led_green,OUTPUT); 9 | pinMode(led_blue,OUTPUT); 10 | } 11 | 12 | void loop() { 13 | int val1 = map(analogRead(A0),0,1023,0,255); 14 | int val2 = map(analogRead(A1),0,1023,0,255); 15 | int val3 = map(analogRead(A2),0,1023,0,255); 16 | 17 | analogWrite(led_red,val1); 18 | analogWrite(led_green,val2); 19 | analogWrite(led_blue,val3); 20 | } 21 | -------------------------------------------------------------------------------- /07 - RGB Led/rgb_led_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/07 - RGB Led/rgb_led_picture.png -------------------------------------------------------------------------------- /09 - LDR/Arduino_LDR/Arduino_LDR.ino: -------------------------------------------------------------------------------- 1 | int pin = A0; 2 | int led = 3; 3 | 4 | int ref = 200; // Led açılıp kapanacağı aralık 5 | 6 | void setup() { 7 | pinMode(pin, INPUT); 8 | pinMode(led, OUTPUT); 9 | Serial.begin(9600); 10 | } 11 | 12 | void loop() { 13 | int gelenDeger = analogRead(pin); 14 | Serial.println(gelenDeger); 15 | 16 | if(gelenDeger > ref) { 17 | digitalWrite(led, LOW); 18 | } 19 | else { 20 | digitalWrite(led, HIGH); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /09 - LDR/Arduino_LDR/LDR.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/09 - LDR/Arduino_LDR/LDR.fzz -------------------------------------------------------------------------------- /09 - LDR/Arduino_LDR/LDR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/09 - LDR/Arduino_LDR/LDR.jpg -------------------------------------------------------------------------------- /09 - LDR/Notlar.md: -------------------------------------------------------------------------------- 1 | ## Fotodireçler (LDR) 2 | 3 | Fotodirençler ışığa bağlı olarak değeri değişen dirençlerdir. LDR (light dependent resistor ) üzerine düşen ışık şiddeti ile LDR'nin direnç değeri ters orantılıdır. Yani ışık şiddetinin artması direnç değerinin düşmesine, ışık şiddetinin azalması ise direnç değerinin artmasına sebep olur. LDR , AC ve DC akımda aynı özellikleri gösterir. LDR ışık ile kontrol gerektiren robot projelerinde ve otomasyonlarda basitçe kullanılabilecek bir sensördür. 4 | 5 | LDR'ler CdS (kadmiyum sülfür), CdSe (kadmiyum selenür), selenyum, germanyum, silisyum gibi ışığa duyarlı maddelerden üretilen dirençlerdir. LDR'lerin üretildikleri madde algılayıcının hassasiyetini ve algılama süresini belirler. LDR'lerin üst kısmı LDR'ye gelen ışığın odaklanmasını sağlamak için cam veya şeffaf plastik ile yapılır. LDR'lerin gövde boyutları büyüdükçe taşıyabilecekleri akım ve buna bağlı olarak güç değerleri artar. 6 | LDR fotodirenç devresi 7 | LDR'lerin sağlamlığını kontrol etmek için ohmmetre ile LDR'nin direncini karanlıkta ve aydınlıkta ölçerek, aydınlıkta az karanlıkta ise çok direnç gösterdikleri gözlenmelidir. 8 | 9 | Yandaki örnek devrede ışık yokken LDR nin direnci yüksek olduğundan transistörün base bacağı tetiklenmemekte ve led sönük durumda kalmaktadır. LDR üzerine ışık geldiğinde ise direnç değeri düştüğünden transistörün base bacağının tetiklenmesine ve ledin yanmasına sebep olmaktadır. -------------------------------------------------------------------------------- /10 - Buzzer/Buzzer.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/10 - Buzzer/Buzzer.fzz -------------------------------------------------------------------------------- /10 - Buzzer/Buzzer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/10 - Buzzer/Buzzer.jpg -------------------------------------------------------------------------------- /10 - Buzzer/Ezel/music/music.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Playtune bytestream for file "Ezel.mid" created by MIDITONES V1.6 on Tue Jan 31 23:43:00 2017 4 | // command line: miditonesV1.6.exe -t3 Ezel 5 | //const byte PROGMEM score1 [] = { 6 | //0x90,60, 0x91,70, 0x92,74, 0,11, 0,11, 0x80, 0x90,66, 0,11, 0x81, 0x91,71, 0,11, 0x80, 7 | //0,11, 0x90,64, 0,11, 0,11, 0x82, 0x92,75, 0,11, 0x80, 0x90,74, 0,11, 0,11, 0x82, 8 | //0x92,87, 0,11, 0x80, 0x90,75, 0,11, 0,11, 0x82, 0,11, 0x92,47, 0x80, 0x90,87, 0,11, 9 | //0,11, 0,11, 0x82, 0,11, 0x92,50, 0,23, 0x82, 0x81, 0x91,73, 0x92,78, 0,11, 0,11, 10 | //0,11, 0,11, 0x81, 0x82, 0x80, 0,11, 0x90,75, 0,23, 0x91,37, 0x92,73, 0,11, 0,11, 11 | //0,11, 0x81, 0x91,92, 0,11, 0,11, 0x80, 0x90,87, 0,11, 0x82, 0x92,75, 0,11, 0,11, 12 | //0x80, 0,11, 0x90,48, 0x81, 0x91,94, 0,11, 0,11, 0x82, 0,11, 0x92,59, 0x81, 0,23, 0x80, 13 | //0x90,49, 0,11, 0x91,37, 0,11, 0x80, 0,11, 0x90,75, 0,11, 0x81, 0x91,66, 0,11, 0x82, 14 | //0x92,60, 0,11, 0,11, 0x82, 0x80, 0x90,90, 0,11, 0x92,102, 0,11, 0,11, 0,11, 0,11, 15 | //0x81, 0,11, 0x91,47, 0,11, 0,11, 0x81, 0x91,48, 0,11, 0x82, 0,11, 0x92,38, 0,23, 16 | //0x82, 0x92,75, 0,11, 0x80, 0,11, 0x90,47, 0x81, 0,11, 0x91,60, 0x82, 0x92,87, 0,11, 0x80, 17 | //0x90,71, 0,11, 0x81, 0x91,61, 0,11, 0,11, 0,23, 0,11, 0,11, 0x80, 0,11, 0x81, 18 | //0,11, 0,11, 0x90,66, 0x82, 0,11, 0x91,48, 0,11, 0x92,59, 0,23, 0x81, 0x82, 0x91,60, 19 | //0x92,65, 0x80, 0,11, 0x90,48, 0,11, 0x81, 0x82, 0x91,90, 0,11, 0x80, 0x90,93, 0,11, 0x92,81, 20 | //0,11, 0,11, 0,11, 0x81, 0,11, 0x80, 0,11, 0x90,48, 0x91,90, 0,11, 0,11, 0x80, 21 | //0x90,49, 0,11, 0,11, 0x80, 0x82, 0,11, 0,11, 0x90,102, 0,11, 0,11, 0x81, 0,11, 22 | //0x91,58, 0,11, 0x92,66, 0,11, 0x81, 0x91,59, 0x80, 0,11, 0x90,74, 0,11, 0x82, 0,11, 23 | //0x92,66, 0,11, 0,11, 0x81, 0x91,60, 0x80, 0x90,75, 0,11, 0x82, 0x92,81, 0,11, 0x81, 0,11, 24 | //0,11, 0x82, 0,11, 0x91,63, 0x92,74, 0x80, 0,23, 0x90,41, 0,11, 0x81, 0,11, 0x80, 0x82, 25 | //0,46, 0,11, 0x90,59, 0,23, 0x91,42, 0x92,66, 0,11, 0,11, 0x81, 0x91,45, 0x80, 0x90,60, 26 | //0,11, 0x82, 0x92,67, 0,11, 0x81, 0x91,55, 0,11, 0,11, 0,11, 0x81, 0,11, 0x82, 0x91,71, 27 | //0,11, 0x92,47, 0,11, 0,11, 0x82, 0x92,48, 0,11, 0,23, 0x81, 0x91,76, 0,23, 0,11, 28 | //0,23, 0x82, 0x81, 0,11, 0x91,48, 0,11, 0x92,76, 0,23, 0x81, 0,11, 0x91,74, 0x82, 0,23, 29 | //0x92,44, 0,11, 0x80, 0,11, 0x82, 0x90,55, 0,11, 0x92,59, 0,11, 0x80, 0x90,67, 0x81, 0,11, 30 | //0x82, 0x91,60, 0,11, 0x92,71, 0,11, 0,11, 0,11, 0,11, 0,23, 0x82, 0,11, 0,11, 31 | //0x92,64, 0x80, 0,11, 0x90,88, 0,23, 0x82, 0,11, 0x92,48, 0x81, 0,11, 0x91,71, 0,34, 32 | //0x82, 0x80, 0,11, 0x90,64, 0,11, 0x92,67, 0,11, 0,11, 0x80, 0,34, 0x81, 0,11, 0x90,49, 33 | //0,23, 0x82, 0,11, 0x91,84, 0x92,95, 0,11, 0x80, 0x90,50, 0,11, 0,11, 0x80, 0x81, 0x82, 34 | //0,11, 0x90,41, 0x91,71, 0,11, 0x92,54, 0,11, 0,11, 0x80, 0x90,49, 0x82, 0x92,55, 0x81, 35 | //0,11, 0,11, 0x91,41, 0x80, 0x82, 0x90,56, 0x92,60, 0,23, 0x81, 0x91,55, 0x80, 0,11, 0,11, 36 | //0x82, 0,11, 0x90,40, 0x81, 0,11, 0x91,56, 0x92,65, 0,11, 0x80, 0,11, 0x90,40, 0x81, 0,11}; 37 | const byte PROGMEM score2 [] = { 38 | //0x90,79, 0x91,64, 3,89, 0x81, 0x91,67, 0x92,71, 3,89, 0x81, 0x82, 0x91,67, 0x92,71, 3,89, 39 | //0x80, 0x81, 0x82, 0x90,78, 0x91,62, 0x92,69, 0,214, 0x80, 0x90,79, 0,214, 0x80, 0x90,81, 0,214, 40 | //0x80, 0x90,78, 0,214, 0x81, 0x82, 0x80, 0x90,64, 0x91,79, 3,89, 0x80, 0x90,67, 0x92,71, 3,89, 41 | //0x80, 0x82, 0x90,67, 0x92,71, 3,89, 0x81, 0x80, 0x82, 0x90,78, 0x91,62, 0x92,69, 0,214, 0x80, 0x90,79, 42 | //0,214, 0x80, 0x90,81, 0,214, 0x80, 0x90,78, 0,214, 0x81, 0x82, 0x80, 0x90,60, 0x91,79, 0x92,67, 43 | //1,172, 0x81, 0x91,76, 1,172, 0x80, 0x82, 0x81, 0x90,59, 0x91,78, 0x92,66, 1,172, 0x81, 0x91,74, 44 | //1,172, 0x80, 0x82, 0x81, 0x90,57, 0x91,76, 0x92,64, 1,172, 0x81, 0x91,72, 1,172, 0x80, 0x82, 0x81, 45 | //3,89, 0x90,59, 0x91,78, 1,172, 0x81, 0x91,74, 1,172, 0x80, 0x81, 0x90,66, 0x91,71, 3,89, 46 | //0x80, 0x81, 0x90,66, 0x91,71, 3,89, 0x80, 0x81, 0x90,66, 0x91,71, 3,89, 0x92,79, 0x80, 0x81, 0x90,64, 47 | //3,89, 0x82, 0x80, 0x90,78, 0x91,67, 0x92,71, 3,89, 0x80, 0x81, 0x82, 0x90,76, 0x91,67, 0x92,71, 48 | //3,89, 0x81, 0x82, 0x91,67, 0x92,71, 3,89, 0x80, 0x81, 0x82, 0x90,79, 0x91,52, 0x92,55, 3,89, 49 | //0x81, 0x82, 0x91,59, 0x92,64, 3,89, 0x81, 0x82, 0x91,59, 0x92,64, 3,89, 0x80, 0x81, 0x82, 0x90,78, 50 | //0x91,54, 0x92,57, 0,214, 0x80, 0x90,79, 0,214, 0x80, 0x90,81, 0,214, 0x80, 0x90,78, 0,214, 51 | //0x81, 0x82, 0x80, 0x90,55, 0x91,79, 0x92,59, 3,89, 0x80, 0x82, 0x90,59, 0x92,64, 3,89, 0x80, 0x82, 52 | //0x90,59, 0x92,64, 3,89, 0x81, 0x80, 0x82, 0x90,78, 0x91,54, 0x92,57, 0,214, 0x80, 0x90,79, 0,214, 53 | //0x80, 0x90,81, 0,214, 0x80, 0x90,78, 0,214, 0x81, 0x82, 0x80, 0x90,48, 0x91,79, 0x92,52, 1,172, 54 | //0x81, 0x91,76, 1,172, 0x80, 0x82, 0x81, 0x90,47, 0x91,78, 0x92,50, 1,172, 0x81, 0x91,74, 1,172, 55 | //0x80, 0x82, 0x81, 0x90,45, 0x91,76, 0x92,48, 1,172, 0x81, 0x91,72, 1,172, 0x80, 0x82, 0x81, 3,89, 56 | //0x90,47, 0x91,78, 1,172, 0x81, 0x91,74, 1,172, 0x80, 0x81, 0x90,54, 0x91,59, 3,89, 0x80, 0x81, 57 | //0x90,54, 0x91,59, 3,89, 0x80, 0x81, 0x90,54, 0x91,59, 3,89, 0x92,76, 0x80, 0x81, 0x90,52, 3,89, 58 | //0x80, 0x90,55, 0x91,59, 3,89, 0x80, 0x81, 0x90,55, 0x91,59, 3,89, 0x80, 0x81, 0x90,55, 0x91,59, 59 | //3,89, 0x82, 0x80, 0x81, 0x90,55, 0x91,40, 1,172, 0x81, 0x91,47, 1,172, 0x81, 0x91,52, 1,172, 60 | //0x81, 0x91,52, 1,172, 0x81, 1,172, 0x91,47, 1,172, 0x80, 0x81, 0x90,54, 0x91,40, 0,214, 0x80, 61 | //0x90,55, 0,214, 0x80, 0x90,57, 0,214, 0x80, 0x90,54, 0,214, 0x81, 0x80, 0x90,40, 0x91,55, 1,172, 62 | //0x80, 0x90,47, 1,172, 0x80, 0x90,52, 1,172, 0x80, 0x90,52, 1,172, 0x80, 1,172, 0x90,47, 1,172, 63 | //0x81, 0x80, 0x90,54, 0x91,40, 0,214, 0x80, 0x90,55, 0,214, 0x80, 0x90,57, 0,214, 0x80, 0x90,54, 64 | //0,214, 0x81, 0x80, 0x90,36, 0x91,55, 0x92,48, 1,172, 0x81, 0x91,52, 1,172, 0x80, 0x82, 0x81, 0x90,35, 65 | //0x91,54, 0x92,47, 1,172, 0x81, 0x91,50, 1,172, 0x80, 0x82, 0x81, 0x90,33, 0x91,52, 0x92,45, 1,172, 66 | //0x81, 0x91,48, 1,172, 0x81, 3,89, 0x80, 0x82, 0x90,54, 0x91,35, 1,172, 0x80, 0x81, 0x90,50, 0x91,42, 67 | //1,172, 0x80, 0x81, 0x90,47, 1,172, 0x80, 0x90,47, 1,172, 0x80, 3,89, 0x90,35, 3,89, 0x91,54, 68 | //0x80, 0x90,40, 1,172, 0x81, 0x80, 0x90,52, 0x91,47, 1,172, 0x80, 0x81, 0x90,52, 1,172, 0x80, 0x90,52, 69 | //1,172, 0x80, 3,89, 0x90,40, 3,89, 0x91,67, 0x80, 0x90,40, 1,172, 0x80, 0x90,47, 1,172, 70 | //0x80, 0x90,52, 1,172, 0x80, 0x90,52, 1,172, 0x80, 1,172, 0x90,47, 1,172, 0x81, 0x80, 0x90,66, 71 | //0x91,38, 0,214, 0x80, 0x90,67, 0,214, 0x80, 0x90,69, 0,214, 0x80, 0x90,66, 0,214, 0x81, 0x80, 72 | //0x90,40, 0x91,67, 1,172, 0x80, 0x90,47, 1,172, 0x80, 0x90,52, 1,172, 0x80, 0x90,52, 1,172, 73 | //0x80, 1,172, 0x90,47, 1,172, 0x81, 0x80, 0x90,66, 0x91,38, 0,214, 0x80, 0x90,67, 0,214, 0x80, 74 | //0x90,69, 0,214, 0x80, 0x90,66, 0,214, 0x81, 0x80, 0x90,36, 0x91,67, 0x92,48, 1,172, 0x81, 0x91,64, 75 | //1,172, 0x80, 0x82, 0x81, 0x90,35, 0x91,66, 0x92,47, 1,172, 0x81, 0x91,62, 1,172, 0x80, 0x82, 0x81, 76 | //0x90,33, 0x91,64, 0x92,45, 1,172, 0x81, 0x91,60, 1,172, 0x81, 3,89, 0x80, 0x82, 0x90,66, 0x91,35, 77 | //1,172, 0x80, 0x81, 0x90,62, 0x91,42, 1,172, 0x80, 0x81, 0x90,47, 1,172, 0x80, 0x90,47, 1,172, 78 | //0x80, 3,89, 0x90,35, 3,89, 0x91,66, 0x80, 0x90,40, 1,172, 0x81, 0x80, 0x90,64, 0x91,47, 1,172, 79 | //0x80, 0x81, 0x90,52, 1,172, 0x80, 0x90,52, 1,172, 0x80, 6,178, 0x90,79, 0x91,36, 0x92,43, 0,214, 80 | //0x80, 0x90,78, 0,214, 0x80, 0x90,79, 1,172, 0x81, 0x82, 0x80, 0x90,43, 0x91,48, 0,214, 0x92,78, 81 | //0,214, 0x82, 0x92,79, 0,214, 0x82, 0x92,81, 0,214, 0x80, 0x81, 0x82, 0x90,86, 1,172, 0x91,43, 82 | //0x92,48, 1,172, 0x80, 0x81, 0x82, 0x90,84, 0,214, 0x80, 0x90,83, 0,214, 0x80, 0x90,81, 1,172, 83 | //0x91,36, 0x80, 0x90,45, 0x92,81, 0,214, 0x82, 0x92,79, 0,214, 0x82, 0x92,81, 1,172, 0x81, 0x80, 84 | //0x82, 0x90,45, 0x91,48, 0,214, 0x92,79, 0,214, 0x82, 0x92,83, 0,214, 0x82, 0x92,79, 0,214, 85 | //0x80, 0x81, 0x82, 0x90,81, 1,172, 0x91,45, 0x92,48, 0,214, 0x80, 0x90,79, 0,214, 0x81, 0x82, 0x80, 86 | //0x90,83, 2,130, 0x80, 0x90,81, 0,214, 0x91,36, 0x80, 0x90,43, 0x92,79, 0,214, 0x82, 0x92,78, 87 | //0,214, 0x82, 0x92,79, 1,172, 0x81, 0x80, 0x82, 0x90,43, 0x91,48, 0,214, 0x92,78, 0,214, 0x82, 88 | //0x92,79, 0,214, 0x82, 0x92,81, 0,214, 0x80, 0x81, 0x82, 0x90,86, 1,172, 0x91,43, 0x92,48, 1,172, 89 | //0x80, 0x81, 0x82, 0x90,84, 0,214, 0x80, 0x90,83, 0,214, 0x80, 0x90,81, 1,172, 0x91,36, 0x80, 0x90,45, 90 | //0x92,81, 0,214, 0x82, 0x92,79, 0,214, 0x82, 0x92,81, 1,172, 0x81, 0x80, 0x82, 0x90,45, 0x91,48, 91 | //0,214, 0x92,79, 0,214, 0x82, 0x92,83, 0,214, 0x82, 0x92,79, 0,214, 0x80, 0x81, 0x82, 0x90,81, 92 | //2,130, 0x80, 0x90,79, 0,214, 0x91,47, 0x80, 0x90,50, 0x92,83, 2,23, 0,107, 0,107, 0,107, 93 | //0x81, 0x80, 0x82, 0x90,48, 0x91,84, 0x92,52, 3,89, 0x80, 0x82, 0x90,48, 0x92,52, 3,89, 0x80, 0x82, 94 | //0x90,48, 0x92,52, 3,89, 0x80, 0x82, 0x90,48, 0x92,52, 3,89, 0x81, 0x80, 0x82, 0x90,78, 0x91,50, 95 | //0x92,54, 3,89, 0x81, 0x82, 0x91,50, 0x92,54, 3,89, 0x81, 0x82, 0x91,50, 0x92,54, 3,89, 0x81, 96 | //0x82, 0x91,50, 0x92,54, 3,89, 0x80, 0x81, 0x82, 0x90,79, 0x91,47, 0x92,52, 2,130, 0,107, 0,107, 97 | //0x81, 0x82, 0x80, 0x90,47, 0x91,78, 0x92,50, 2,130, 0,107, 0,107, 0x80, 0x82, 0x81, 0x90,40, 0x91,76, 98 | //0x92,47, 6,178, 0x81, 0x80, 0x82, 0x90,55, 0x91,40, 0x92,59, 1,172, 0x81, 0x91,47, 1,172, 0x81, 99 | //0x91,52, 1,172, 0x81, 0x91,52, 1,172, 0x81, 1,172, 0x91,47, 1,172, 0x80, 0x82, 0x81, 0x90,54, 100 | //0x91,38, 0x92,57, 0,214, 0x80, 0x82, 0x90,55, 0,214, 0x80, 0x90,57, 0,214, 0x80, 0x90,54, 0,214, 101 | //0x81, 0x80, 0x90,40, 0x91,55, 0x92,59, 1,172, 0x80, 0x90,47, 1,172, 0x80, 0x90,52, 1,172, 0x80, 102 | //0x90,52, 1,172, 0x80, 1,172, 0x90,47, 1,172, 0x81, 0x82, 0x80, 0x90,54, 0x91,38, 0x92,57, 0,214, 103 | //0x80, 0x82, 0x90,55, 0,214, 0x80, 0x90,57, 0,214, 0x80, 0x90,54, 0,214, 0x81, 0x80, 0x90,36, 0x91,55, 104 | //0x92,48, 1,172, 0x81, 0x91,52, 1,172, 0x80, 0x82, 0x81, 0x90,35, 0x91,54, 0x92,47, 1,172, 0x81, 105 | //0x91,50, 1,172, 0x80, 0x82, 0x81, 0x90,33, 0x91,52, 0x92,45, 1,172, 0x81, 0x91,48, 1,172, 0x81, 106 | //3,89, 0x80, 0x82, 0x90,54, 0x91,35, 1,172, 0x80, 0x81, 0x90,50, 0x91,42, 1,172, 0x80, 0x81, 0x90,47, 107 | //1,172, 0x80, 0x90,47, 1,172, 0x80, 3,89, 0x90,35, 3,89, 0x91,54, 0x80, 0x90,40, 1,172, 108 | //0x81, 0x80, 0x90,52, 0x91,47, 1,172, 0x80, 0x81, 0x90,52, 1,172, 0x80, 0x90,52, 1,172, 0x80, 6,178, 109 | 110 | //0x90,79, 0x91,64, 1,172, 0x81, 0x91,71, 1,172, 0x81, 0x91,76, 6,178, 0x80, 0x90,78, 0,214, 111 | //0x80, 0x90,79, 0,214, 0x80, 0x90,81, 0,214, 0x80, 0x90,78, 0,214, 0x81, 0x80, 0x90,64, 0x91,79, 112 | //1,172, 0x80, 0x90,71, 1,172, 0x80, 0x90,76, 6,178, 0x81, 0x91,78, 0,214, 0x81, 0x91,79, 0,214, 113 | //0x81, 0x91,81, 0,214, 0x81, 0x91,78, 0,214, 0x80, 0x81, 0x90,60, 0x91,79, 1,172, 0x80, 0x81, 0x90,67, 114 | //0x91,76, 1,172, 0x80, 0x81, 0x90,59, 0x91,78, 1,172, 0x80, 0x81, 0x90,66, 0x91,74, 1,172, 0x80, 115 | //0x81, 0x90,57, 0x91,76, 1,172, 0x80, 0x81, 0x90,64, 0x91,72, 1,172, 0x80, 0x81, 3,89, 0x90,59, 116 | //0x91,78, 1,172, 0x80, 0x81, 0x90,66, 0x91,74, 1,172, 0x80, 0x81, 3,89, 0x90,79, 3,89, 0x80, 117 | //0x90,81, 3,89, 0x91,64, 0x80, 0x90,79, 0,214, 0x80, 0x90,78,0,214, 0x81, 0x80,0x90,71, 0x91,76, 118 | 1,172, 0x80, 0x81, 10,11, 0x90,76, 0x91,91, 1,172, 0x80, 0x90,83, 1,172, 0x80, 0x90,88, 6,178, 119 | 0x81, 0x91,90, 0,214, 0x81, 0x91,91, 0,214, 0x81, 0x91,93, 0,214, 0x81, 0x91,90, 0,214, 0x80, 120 | 0x81, 0x90,76, 0x91,91, 1,172, 0x80, 0x90,83, 1,172, 0x80, 0x90,88, 6,178, 0x81, 0x91,90, 0,214, 121 | 0x81, 0x91,91, 0,214, 0x81, 0x91,93, 0,214, 0x81, 0x91,90, 0,214, 0x80, 0x81, 0x90,72, 0x91,91, 122 | 1,172, 0x80, 0x81, 0x90,79, 0x91,88, 1,172, 0x80, 0x81, 0x90,71, 0x91,90, 1,172, 0x80, 0x81, 0x90,78, 123 | 0x91,86, 1,172, 0x80, 0x81, 0x90,69, 0x91,88, 1,172, 0x80, 0x81, 0x90,76, 0x91,84, 1,172, 0x80, 124 | 0x81, 3,89, 0x90,71, 0x91,90, 1,172, 0x80, 0x81, 0x90,78, 0x91,86, 1,172, 0x80, 0x81, 3,89, 125 | 0x90,88, 3,89, 0x80, 0x90,90, 3,89, 0x91,76, 0x80, 0x90,91, 1,172, 0x81, 0x80, 0x90,83, 0x91,88, 126 | 1,172, 0x80, 0x81, 0xf0}; 127 | // This score contains 1863 bytes, and 3 tone generators are used. 128 | // 26 notes had to be skipped. 129 | 130 | 131 | 132 | Playtune pt; 133 | 134 | void setup() { 135 | pt.tune_initchan (10); 136 | pt.tune_initchan (11); 137 | pt.tune_initchan (12); 138 | } 139 | 140 | void loop () { 141 | //pt.tune_playscore((byte *) score1); /* start playing */ 142 | pt.tune_playscore((byte *) score2); /* start playing */ 143 | while (pt.tune_playing) ; /* wait here until playing stops */ 144 | } 145 | -------------------------------------------------------------------------------- /10 - Buzzer/Mario/Mario.ino: -------------------------------------------------------------------------------- 1 | #define NOTE_B0 31 2 | #define NOTE_C1 33 3 | #define NOTE_CS1 35 4 | #define NOTE_D1 37 5 | #define NOTE_DS1 39 6 | #define NOTE_E1 41 7 | #define NOTE_F1 44 8 | #define NOTE_FS1 46 9 | #define NOTE_G1 49 10 | #define NOTE_GS1 52 11 | #define NOTE_A1 55 12 | #define NOTE_AS1 58 13 | #define NOTE_B1 62 14 | #define NOTE_C2 65 15 | #define NOTE_CS2 69 16 | #define NOTE_D2 73 17 | #define NOTE_DS2 78 18 | #define NOTE_E2 82 19 | #define NOTE_F2 87 20 | #define NOTE_FS2 93 21 | #define NOTE_G2 98 22 | #define NOTE_GS2 104 23 | #define NOTE_A2 110 24 | #define NOTE_AS2 117 25 | #define NOTE_B2 123 26 | #define NOTE_C3 131 27 | #define NOTE_CS3 139 28 | #define NOTE_D3 147 29 | #define NOTE_DS3 156 30 | #define NOTE_E3 165 31 | #define NOTE_F3 175 32 | #define NOTE_FS3 185 33 | #define NOTE_G3 196 34 | #define NOTE_GS3 208 35 | #define NOTE_A3 220 36 | #define NOTE_AS3 233 37 | #define NOTE_B3 247 38 | #define NOTE_C4 262 39 | #define NOTE_CS4 277 40 | #define NOTE_D4 294 41 | #define NOTE_DS4 311 42 | #define NOTE_E4 330 43 | #define NOTE_F4 349 44 | #define NOTE_FS4 370 45 | #define NOTE_G4 392 46 | #define NOTE_GS4 415 47 | #define NOTE_A4 440 48 | #define NOTE_AS4 466 49 | #define NOTE_B4 494 50 | #define NOTE_C5 523 51 | #define NOTE_CS5 554 52 | #define NOTE_D5 587 53 | #define NOTE_DS5 622 54 | #define NOTE_E5 659 55 | #define NOTE_F5 698 56 | #define NOTE_FS5 740 57 | #define NOTE_G5 784 58 | #define NOTE_GS5 831 59 | #define NOTE_A5 880 60 | #define NOTE_AS5 932 61 | #define NOTE_B5 988 62 | #define NOTE_C6 1047 63 | #define NOTE_CS6 1109 64 | #define NOTE_D6 1175 65 | #define NOTE_DS6 1245 66 | #define NOTE_E6 1319 67 | #define NOTE_F6 1397 68 | #define NOTE_FS6 1480 69 | #define NOTE_G6 1568 70 | #define NOTE_GS6 1661 71 | #define NOTE_A6 1760 72 | #define NOTE_AS6 1865 73 | #define NOTE_B6 1976 74 | #define NOTE_C7 2093 75 | #define NOTE_CS7 2217 76 | #define NOTE_D7 2349 77 | #define NOTE_DS7 2489 78 | #define NOTE_E7 2637 79 | #define NOTE_F7 2794 80 | #define NOTE_FS7 2960 81 | #define NOTE_G7 3136 82 | #define NOTE_GS7 3322 83 | #define NOTE_A7 3520 84 | #define NOTE_AS7 3729 85 | #define NOTE_B7 3951 86 | #define NOTE_C8 4186 87 | #define NOTE_CS8 4435 88 | #define NOTE_D8 4699 89 | #define NOTE_DS8 4978 90 | 91 | #define melodyPin 3 92 | //Mario main theme melody 93 | int melody[] = { 94 | NOTE_E7, NOTE_E7, 0, NOTE_E7, 95 | 0, NOTE_C7, NOTE_E7, 0, 96 | NOTE_G7, 0, 0, 0, 97 | NOTE_G6, 0, 0, 0, 98 | 99 | NOTE_C7, 0, 0, NOTE_G6, 100 | 0, 0, NOTE_E6, 0, 101 | 0, NOTE_A6, 0, NOTE_B6, 102 | 0, NOTE_AS6, NOTE_A6, 0, 103 | 104 | NOTE_G6, NOTE_E7, NOTE_G7, 105 | NOTE_A7, 0, NOTE_F7, NOTE_G7, 106 | 0, NOTE_E7, 0, NOTE_C7, 107 | NOTE_D7, NOTE_B6, 0, 0, 108 | 109 | NOTE_C7, 0, 0, NOTE_G6, 110 | 0, 0, NOTE_E6, 0, 111 | 0, NOTE_A6, 0, NOTE_B6, 112 | 0, NOTE_AS6, NOTE_A6, 0, 113 | 114 | NOTE_G6, NOTE_E7, NOTE_G7, 115 | NOTE_A7, 0, NOTE_F7, NOTE_G7, 116 | 0, NOTE_E7, 0, NOTE_C7, 117 | NOTE_D7, NOTE_B6, 0, 0 118 | }; 119 | //Mario main them tempo 120 | int tempo[] = { 121 | 12, 12, 12, 12, 122 | 12, 12, 12, 12, 123 | 12, 12, 12, 12, 124 | 12, 12, 12, 12, 125 | 126 | 12, 12, 12, 12, 127 | 12, 12, 12, 12, 128 | 12, 12, 12, 12, 129 | 12, 12, 12, 12, 130 | 131 | 9, 9, 9, 132 | 12, 12, 12, 12, 133 | 12, 12, 12, 12, 134 | 12, 12, 12, 12, 135 | 136 | 12, 12, 12, 12, 137 | 12, 12, 12, 12, 138 | 12, 12, 12, 12, 139 | 12, 12, 12, 12, 140 | 141 | 9, 9, 9, 142 | 12, 12, 12, 12, 143 | 12, 12, 12, 12, 144 | 12, 12, 12, 12, 145 | }; 146 | //Underworld melody 147 | int underworld_melody[] = { 148 | NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4, 149 | NOTE_AS3, NOTE_AS4, 0, 150 | 0, 151 | NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4, 152 | NOTE_AS3, NOTE_AS4, 0, 153 | 0, 154 | NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4, 155 | NOTE_DS3, NOTE_DS4, 0, 156 | 0, 157 | NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4, 158 | NOTE_DS3, NOTE_DS4, 0, 159 | 0, NOTE_DS4, NOTE_CS4, NOTE_D4, 160 | NOTE_CS4, NOTE_DS4, 161 | NOTE_DS4, NOTE_GS3, 162 | NOTE_G3, NOTE_CS4, 163 | NOTE_C4, NOTE_FS4, NOTE_F4, NOTE_E3, NOTE_AS4, NOTE_A4, 164 | NOTE_GS4, NOTE_DS4, NOTE_B3, 165 | NOTE_AS3, NOTE_A3, NOTE_GS3, 166 | 0, 0, 0 167 | }; 168 | //Underwolrd tempo 169 | int underworld_tempo[] = { 170 | 12, 12, 12, 12, 171 | 12, 12, 6, 172 | 3, 173 | 12, 12, 12, 12, 174 | 12, 12, 6, 175 | 3, 176 | 12, 12, 12, 12, 177 | 12, 12, 6, 178 | 3, 179 | 12, 12, 12, 12, 180 | 12, 12, 6, 181 | 6, 18, 18, 18, 182 | 6, 6, 183 | 6, 6, 184 | 6, 6, 185 | 18, 18, 18, 18, 18, 18, 186 | 10, 10, 10, 187 | 10, 10, 10, 188 | 3, 3, 3 189 | }; 190 | 191 | void setup(void) 192 | { 193 | pinMode(3, OUTPUT);//buzzer 194 | pinMode(13, OUTPUT);//led indicator when singing a note 195 | 196 | } 197 | void loop() 198 | { 199 | //sing the tunes 200 | sing(1); 201 | sing(1); 202 | sing(2); 203 | } 204 | int song = 0; 205 | 206 | void sing(int s) { 207 | // iterate over the notes of the melody: 208 | song = s; 209 | if (song == 2) { 210 | Serial.println(" 'Underworld Theme'"); 211 | int size = sizeof(underworld_melody) / sizeof(int); 212 | for (int thisNote = 0; thisNote < size; thisNote++) { 213 | 214 | // to calculate the note duration, take one second 215 | // divided by the note type. 216 | //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. 217 | int noteDuration = 1000 / underworld_tempo[thisNote]; 218 | 219 | buzz(melodyPin, underworld_melody[thisNote], noteDuration); 220 | 221 | // to distinguish the notes, set a minimum time between them. 222 | // the note's duration + 30% seems to work well: 223 | int pauseBetweenNotes = noteDuration * 1.30; 224 | delay(pauseBetweenNotes); 225 | 226 | // stop the tone playing: 227 | buzz(melodyPin, 0, noteDuration); 228 | 229 | } 230 | 231 | } else { 232 | 233 | Serial.println(" 'Mario Theme'"); 234 | int size = sizeof(melody) / sizeof(int); 235 | for (int thisNote = 0; thisNote < size; thisNote++) { 236 | 237 | // to calculate the note duration, take one second 238 | // divided by the note type. 239 | //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. 240 | int noteDuration = 1000 / tempo[thisNote]; 241 | 242 | buzz(melodyPin, melody[thisNote], noteDuration); 243 | 244 | // to distinguish the notes, set a minimum time between them. 245 | // the note's duration + 30% seems to work well: 246 | int pauseBetweenNotes = noteDuration * 1.30; 247 | delay(pauseBetweenNotes); 248 | 249 | // stop the tone playing: 250 | buzz(melodyPin, 0, noteDuration); 251 | 252 | } 253 | } 254 | } 255 | 256 | void buzz(int targetPin, long frequency, long length) { 257 | digitalWrite(13, HIGH); 258 | long delayValue = 1000000 / frequency / 2; // calculate the delay value between transitions 259 | //// 1 second's worth of microseconds, divided by the frequency, then split in half since 260 | //// there are two phases to each cycle 261 | long numCycles = frequency * length / 1000; // calculate the number of cycles for proper timing 262 | //// multiply frequency, which is really cycles per second, by the number of seconds to 263 | //// get the total number of cycles to produce 264 | for (long i = 0; i < numCycles; i++) { // for the calculated length of time... 265 | digitalWrite(targetPin, HIGH); // write the buzzer pin high to push out the diaphram 266 | delayMicroseconds(delayValue); // wait for the calculated delay value 267 | digitalWrite(targetPin, LOW); // write the buzzer pin low to pull back the diaphram 268 | delayMicroseconds(delayValue); // wait again or the calculated delay value 269 | } 270 | digitalWrite(13, LOW); 271 | 272 | } 273 | -------------------------------------------------------------------------------- /10 - Buzzer/Playtunes/Playtune.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Playtune: An Arduino Tune Generator library 4 | * 5 | * Plays a polyphonic musical score. 6 | * 7 | * (C) Copyright 2011, Len Shustek 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of version 3 of the GNU General Public License as 11 | * published by the Free Software Foundation at http://www.gnu.org/licenses, 12 | * with Additional Permissions under term 7(b) that the original copyright 13 | * notice and author attibution must be preserved and under term 7(c) that 14 | * modified versions be marked as different from the original. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * This was inspired by and adapted from "A Tone Generator Library", 22 | * written by Brett Hagman, http://www.roguerobotics.com/ 23 | * 24 | **************************************************************************/ 25 | /* 26 | * Change log 27 | * 19 January 2011, L.Shustek, V1.0 28 | * - Initial release. 29 | * 23 February 2011, L. Shustek, V1.1 30 | * - prevent hang if delay rounds to count of 0 31 | * 4 December 2011, L. Shustek, V1.2 32 | * - add special TESLA_COIL mods 33 | * 10 June 2013, L. Shustek, V1.3 34 | * - change to be compatible with Arduino IDE version 1.0.5 35 | * 36 | */ 37 | 38 | /*--------------------------------------------------------------------------------- 39 | * 40 | * 41 | * About Playtune 42 | * 43 | * 44 | * Playtune interprets a bytestream of commands that represent a polyphonic musical 45 | * score. It uses the Arduino counters for generating tones, so the number of 46 | * simultaneous notes that can be played depends on which processor you have. 47 | * The NANO allows 3, and the MEGA 2560 allows 6. Each timer (tone generator) can 48 | * be associated with any digital output pin, not just the pins that are internally 49 | * connected to the timer. 50 | * 51 | * Once a score starts playing, all of the processing happens in interrupt routines, 52 | * so any other "real" program can be running at the same time, as long as it doesn't 53 | * use the timers or output pins that Playtune is using. Playtune generates a lot of 54 | * interrupts because the toggling of the output bits is done in software, not by the 55 | * timer hardware. But measurements I've made on a NANO show that Playtune uses less 56 | * than 10% of the available processor cycles even when playing all three channels at 57 | * pretty high frequencies. 58 | * 59 | * The easiest way to hear the music is to connect each of the output pins to a resistor 60 | * (500 ohms, say). Connect other ends of the resistors together and then to one 61 | * terminal of an 8-ohm speaker. The other terminal of the speaker is connected to 62 | * ground. No other hardware is needed! If you are going to connect to an amplifier, 63 | * you should DC-isolate the signal using a capacitor. 64 | * 65 | * There is no volume modulation. All tones are played at the same volume, which 66 | * makes some scores sound strange. This is definitely not a high-quality synthesizer. 67 | * 68 | * 69 | * ***** The public Playtune interface ***** 70 | * 71 | * There are five public functions and one public variable. 72 | * 73 | * void tune_initchan(byte pin) 74 | * 75 | * Call this to initialize each of the tone generators you want to use. The argument 76 | * says which pin to use as output. The pin numbers are the digital "D" pins 77 | * silkscreened on the Arduino board. Calling this more times than your processor 78 | * has timers will do no harm, but will not help either. 79 | * 80 | * void tune_playscore (byte *score) 81 | * 82 | * Call this pointing to a "score bytestream" to start playing a tune. It will 83 | * only play as many simultaneous notes as you have initialized tone generators; 84 | * any more will be ignored. See below for the format of the score bytestream. 85 | * 86 | * boolean tune_playing 87 | * 88 | * This global variable will be "true" if a score is playing, and "false" if not. 89 | * You can use this to see when a score has finished. 90 | * 91 | * void tune_stopscore() 92 | * 93 | * This will stop a currently playing score without waiting for it to end by itself. 94 | * 95 | * void tune_delay (unsigned int msec) 96 | * 97 | * Delay for "msec" milliseconds. This is provided because the usual Arduino 98 | * "delay" function will stop working if you use all of your processor's 99 | * timers for generating tones. 100 | * 101 | * void tune_stopchans () 102 | * 103 | * This disconnects all the timers from their pins and stops the interrupts. 104 | * Do this when you don't want to play any more tunes. 105 | * 106 | * 107 | * ***** The score bytestream ***** 108 | * 109 | * The bytestream is a series of commands that can turn notes on and off, and can 110 | * start a waiting period until the next note change. Here are the details, with 111 | * numbers shown in hexadecimal. 112 | * 113 | * If the high-order bit of the byte is 1, then it is one of the following commands: 114 | * 115 | * 9t nn Start playing note nn on tone generator t. Generators are numbered 116 | * starting with 0. The notes numbers are the MIDI numbers for the chromatic 117 | * scale, with decimal 60 being Middle C, and decimal 69 being Middle A 118 | * at 440 Hz. The highest note is decimal 127 at about 12,544 Hz. 119 | * 120 | * 8t Stop playing the note on tone generator t. 121 | * 122 | * F0 End of score: stop playing. 123 | * 124 | * E0 End of score: start playing again from the beginning. 125 | * 126 | * If the high-order bit of the byte is 0, it is a command to wait. The other 7 bits 127 | * and the 8 bits of the following byte are interpreted as a 15-bit big-endian integer 128 | * that is the number of milliseconds to wait before processing the next command. 129 | * For example, 130 | * 131 | * 07 D0 132 | * 133 | * would cause a wait of 0x07d0 = 2000 decimal millisconds or 2 seconds. Any tones 134 | * that were playing before the wait command will continue to play. 135 | * 136 | * The score is stored in Flash memory ("PROGMEM") along with the program, because 137 | * there's a lot more of that than data memory. 138 | * 139 | * 140 | * ***** Where does the score data come from? ***** 141 | * 142 | * Well, you can write the score by hand from the instructions above, but that's 143 | * pretty hard. An easier way is to translate MIDI files into these score commands, 144 | * and I've written a program called "miditones" to do that. See the separate 145 | * documentation for that program, which is also open source. 146 | * 147 | * 148 | * ***** More gory details ***** 149 | * 150 | * The number of hardware timers, and therefore the number of tones that can be 151 | * played simultaneously, depends on the processor that is on your board: 152 | * 153 | * ATMega8: 2 tones (timers 2 and 1) 154 | * ATmega168/328: 3 tones (timers 2, 1, and 0) 155 | * ATmega1280/2560: 6 tones (timers 2, 3, 4, 5, 1, and 0) 156 | * 157 | * The order listed above is the order that timers are assigned as you make 158 | * succesive calls to play_initchan(). Timer 0 is assigned last, because using 159 | * it will disable the Arduino millis(), delay(), and the PWM functions. 160 | * 161 | * The lowest MIDI note that can be played using the 8-bit timers (0 and 2) 162 | * depends on your processor's clock frequency. 163 | * 8 Mhz clock: note 12 (about 16.5 Hz, which is below the piano keyboard) 164 | * 16 Mhz clock: note 24 (about 32.5 Hz, C in octave 1) 165 | * 166 | * The highest MIDI note (127, about 12,544 Hz) can always be played, but can't 167 | * always be heard. 168 | * 169 | * 170 | * ***** Nostalgia from me ***** 171 | * 172 | * Writing Playtune was a lot of fun, because it essentially duplicates what I did 173 | * as a graduate student at Stanford University in about 1973. That project used the 174 | * then-new Intel 8008 microprocessor, plus three hardware square-wave generators that 175 | * I built out of 7400-series TTL. The music compiler was written in Pascal and read 176 | * scores that were hand-written in a notation I made up that looked something like 177 | * C Eb 4G 8G+ 2R + F D# 178 | * This was done was before MIDI had been invented, and anyway I wasn't a pianist so I 179 | * would not have been able to record my own playing. I could barely read music well 180 | * enough to transcribe scores, but I created, slowly, quite a few of them. 181 | * 182 | * Len Shustek, 4 Feb 2011 183 | * 184 | -------------------------------------------------------------------------------------*/ 185 | 186 | #define DBUG 0 /* debugging? */ 187 | #define TESLA_COIL 0 /* special Tesla Coil version? */ 188 | 189 | #include 190 | 191 | #include "playtune.h" 192 | 193 | #if defined(__AVR_ATmega8__) 194 | #define TCCR2A TCCR2 195 | #define TCCR2B TCCR2 196 | #define COM2A1 COM21 197 | #define COM2A0 COM20 198 | #define OCR2A OCR2 199 | #define TIMSK2 TIMSK 200 | #define OCIE2A OCIE2 201 | #define TIMER2_COMPA_vect TIMER2_COMP_vect 202 | #define TIMSK1 TIMSK 203 | #endif 204 | 205 | //******* private variables *************** 206 | 207 | // timer ports and masks 208 | 209 | #if !defined(__AVR_ATmega8__) 210 | volatile byte *timer0_pin_port; 211 | volatile byte timer0_pin_mask; 212 | #endif 213 | 214 | volatile byte *timer1_pin_port; 215 | volatile byte timer1_pin_mask; 216 | 217 | volatile byte *timer2_pin_port; 218 | volatile byte timer2_pin_mask; 219 | 220 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 221 | volatile byte *timer3_pin_port; 222 | volatile byte timer3_pin_mask; 223 | 224 | volatile byte *timer4_pin_port; 225 | volatile byte timer4_pin_mask; 226 | 227 | volatile byte *timer5_pin_port; 228 | volatile byte timer5_pin_mask; 229 | #endif 230 | 231 | // Define the order to allocate timers, leaving timers 1 and 0 to last. 232 | 233 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 234 | #define AVAILABLE_TIMERS 6 235 | const byte PROGMEM tune_pin_to_timer_PGM[] = { 236 | 2, 3, 4, 5, 1, 0 }; 237 | #elif defined(__AVR_ATmega8__) 238 | #define AVAILABLE_TIMERS 2 239 | const byte PROGMEM tune_pin_to_timer_PGM[] = { 240 | 2, 1 }; 241 | #else 242 | #define AVAILABLE_TIMERS 3 243 | const byte PROGMEM tune_pin_to_timer_PGM[] = { 244 | 2, 1, 0 }; 245 | #endif 246 | 247 | // Other local varables 248 | 249 | byte _tune_pins[AVAILABLE_TIMERS]; 250 | byte _tune_num_chans = 0; 251 | 252 | /* one of the timers is also used to time 253 | - score waits (whether or not that timer is playing a note) 254 | - tune_delay() delay requests 255 | We currently use timer2, since that one is the first to be allocated. 256 | */ 257 | volatile unsigned wait_timer_frequency2; /* its current frequency */ 258 | volatile unsigned wait_timer_old_frequency2; /* its previous frequency */ 259 | volatile boolean wait_timer_playing = false; /* is it currently playing a note? */ 260 | volatile boolean doing_delay = false; /* are we using it for a tune_delay()? */ 261 | volatile unsigned long wait_toggle_count; /* countdown score waits */ 262 | volatile unsigned long delay_toggle_count; /* countdown tune_ delay() delays */ 263 | 264 | volatile byte *score_start = 0; 265 | volatile byte *score_cursor = 0; 266 | volatile boolean Playtune::tune_playing = false; 267 | 268 | // Table of midi note frequencies * 2 269 | // They are times 2 for greater accuracy, yet still fits in a word. 270 | // Generated from Excel by =ROUND(2*440/32*(2^((x-9)/12)),0) for 0127) note=127; 409 | frequency2 = pgm_read_word (tune_frequencies2_PGM + note); 410 | 411 | if (timer_num == 0 || timer_num == 2) { //***** 8 bit timer ****** 412 | 413 | // make sure the note isn't too low to be playable 414 | if (note < 415 | #if F_CPU <= 8000000UL 416 | 12 417 | #else 418 | 24 419 | #endif 420 | ) return; // ignore if so 421 | 422 | // scan through prescalars to find the best fit 423 | ocr = F_CPU / frequency2 - 1; 424 | prescalarbits = 0b001; // ck/1: same for both timers 425 | if (ocr > 255) { 426 | ocr = F_CPU / frequency2 / 8 - 1; 427 | prescalarbits = 0b010; // ck/8: same for both timers 428 | 429 | if (timer_num == 2 && ocr > 255) { 430 | ocr = F_CPU / frequency2 / 32 - 1; 431 | prescalarbits = 0b011; 432 | } 433 | 434 | if (ocr > 255) { 435 | ocr = F_CPU / frequency2 / 64 - 1; 436 | prescalarbits = timer_num == 0 ? 0b011 : 0b100; 437 | 438 | if (timer_num == 2 && ocr > 255) { 439 | ocr = F_CPU / frequency2 / 128 - 1; 440 | prescalarbits = 0b101; 441 | } 442 | 443 | if (ocr > 255) { 444 | ocr = F_CPU / frequency2 / 256 - 1; 445 | prescalarbits = timer_num == 0 ? 0b100 : 0b110; 446 | if (ocr > 255) { 447 | // can't do any better than /1024 448 | ocr = F_CPU / frequency2 / 1024 - 1; 449 | prescalarbits = timer_num == 0 ? 0b101 : 0b111; 450 | } 451 | } 452 | } 453 | } 454 | 455 | #if !defined(__AVR_ATmega8__) 456 | if (timer_num == 0) TCCR0B = (TCCR0B & 0b11111000) | prescalarbits; 457 | else 458 | #endif 459 | TCCR2B = (TCCR2B & 0b11111000) | prescalarbits; 460 | } 461 | else //****** 16-bit timer ********* 462 | { // two choices for the 16 bit timers: ck/1 or ck/64 463 | ocr = F_CPU / frequency2 - 1; 464 | 465 | prescalarbits = 0b001; 466 | if (ocr > 0xffff) { 467 | ocr = F_CPU / frequency2 / 64 - 1; 468 | prescalarbits = 0b011; 469 | } 470 | 471 | if (timer_num == 1) TCCR1B = (TCCR1B & 0b11111000) | prescalarbits; 472 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 473 | else if (timer_num == 3) TCCR3B = (TCCR3B & 0b11111000) | prescalarbits; 474 | else if (timer_num == 4) TCCR4B = (TCCR4B & 0b11111000) | prescalarbits; 475 | else if (timer_num == 5) TCCR5B = (TCCR5B & 0b11111000) | prescalarbits; 476 | #endif 477 | } 478 | 479 | // Set the OCR for the given timer, then turn on the interrupts 480 | switch (timer_num) { 481 | 482 | #if !defined(__AVR_ATmega8__) 483 | case 0: 484 | OCR0A = ocr; 485 | bitWrite(TIMSK0, OCIE0A, 1); 486 | break; 487 | #endif 488 | 489 | case 1: 490 | OCR1A = ocr; 491 | bitWrite(TIMSK1, OCIE1A, 1); 492 | break; 493 | 494 | case 2: 495 | OCR2A = ocr; 496 | wait_timer_frequency2 = frequency2; // for "tune_delay" function 497 | wait_timer_playing = true; 498 | bitWrite(TIMSK2, OCIE2A, 1); 499 | break; 500 | 501 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 502 | case 3: 503 | OCR3A = ocr; 504 | bitWrite(TIMSK3, OCIE3A, 1); 505 | break; 506 | 507 | case 4: 508 | OCR4A = ocr; 509 | bitWrite(TIMSK4, OCIE4A, 1); 510 | break; 511 | 512 | case 5: 513 | OCR5A = ocr; 514 | bitWrite(TIMSK5, OCIE5A, 1); 515 | break; 516 | #endif 517 | } 518 | } 519 | } 520 | 521 | 522 | //----------------------------------------------- 523 | // Stop playing a note on a particular channel 524 | //----------------------------------------------- 525 | 526 | void tune_stopnote (byte chan) { 527 | byte timer_num; 528 | 529 | #if DBUG 530 | Serial.print ("Stop note "); 531 | Serial.println(chan,DEC); 532 | #endif 533 | 534 | timer_num = pgm_read_byte(tune_pin_to_timer_PGM + chan); 535 | switch (timer_num) { 536 | #if !defined(__AVR_ATmega8__) 537 | case 0: 538 | TIMSK0 &= ~(1 << OCIE0A); // disable the interrupt 539 | *timer0_pin_port &= ~(timer0_pin_mask); // keep pin low after stop 540 | break; 541 | #endif 542 | case 1: 543 | TIMSK1 &= ~(1 << OCIE1A); // disable the interrupt 544 | *timer1_pin_port &= ~(timer1_pin_mask); // keep pin low after stop 545 | break; 546 | case 2: 547 | // We leave the timer2 interrupt running for the "tune_delay" function. 548 | wait_timer_playing = false; 549 | *timer2_pin_port &= ~(timer2_pin_mask); // keep pin low after stop 550 | break; 551 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 552 | case 3: 553 | TIMSK3 &= ~(1 << OCIE3A); // disable the interrupt 554 | *timer3_pin_port &= ~(timer3_pin_mask); // keep pin low after stop 555 | break; 556 | case 4: 557 | TIMSK4 &= ~(1 << OCIE4A); // disable the interrupt 558 | *timer4_pin_port &= ~(timer4_pin_mask); // keep pin low after stop 559 | break; 560 | case 5: 561 | TIMSK5 &= ~(1 << OCIE5A); // disable the interrupt 562 | *timer5_pin_port &= ~(timer5_pin_mask); // keep pin low after stop 563 | break; 564 | #endif 565 | } 566 | } 567 | 568 | //----------------------------------------------- 569 | // Start playing a score 570 | //----------------------------------------------- 571 | 572 | void Playtune::tune_playscore (byte *score) { 573 | score_start = score; 574 | score_cursor = score; 575 | tune_stepscore(); /* execute initial commands */ 576 | Playtune::tune_playing = true; /* release the interrupt routine */ 577 | } 578 | 579 | /* Do score commands until a "wait" is found, or the score is stopped. 580 | This is called initially from tune_playcore, but then is called 581 | from the interrupt routine when waits expire. 582 | */ 583 | 584 | #define CMD_PLAYNOTE 0x90 /* play a note: low nibble is generator #, note is next byte */ 585 | #define CMD_STOPNOTE 0x80 /* stop a note: low nibble is generator # */ 586 | #define CMD_RESTART 0xe0 /* restart the score from the beginning */ 587 | #define CMD_STOP 0xf0 /* stop playing */ 588 | /* if CMD < 0x80, then the other 7 bits and the next byte are a 15-bit big-endian number of msec to wait */ 589 | 590 | 591 | void tune_stepscore (void) { 592 | byte cmd, opcode, chan; 593 | unsigned duration; 594 | 595 | while (1) { 596 | cmd = pgm_read_byte(score_cursor++); 597 | #if DBUG 598 | // Serial.print("cmd "); 599 | // Serial.println(cmd, HEX); 600 | #endif 601 | if (cmd < 0x80) { /* wait count in msec. */ 602 | duration = ((unsigned)cmd << 8) | (pgm_read_byte(score_cursor++)); 603 | wait_toggle_count = ((unsigned long) wait_timer_frequency2 * duration + 500) / 1000; 604 | if (wait_toggle_count == 0) wait_toggle_count = 1; 605 | #if DBUG 606 | Serial.print("wait "); 607 | Serial.print(duration,DEC); 608 | Serial.print(", cnt "); 609 | Serial.println(wait_toggle_count, DEC); 610 | #endif 611 | break; 612 | } 613 | opcode = cmd & 0xf0; 614 | chan = cmd & 0x0f; 615 | if (opcode == CMD_STOPNOTE) { /* stop note */ 616 | tune_stopnote (chan); 617 | } 618 | else if (opcode == CMD_PLAYNOTE) { /* play note */ 619 | tune_playnote (chan, pgm_read_byte(score_cursor++)); 620 | } 621 | else if (opcode == CMD_RESTART) { /* restart score */ 622 | score_cursor = score_start; 623 | } 624 | else if (opcode == CMD_STOP) { /* stop score */ 625 | Playtune::tune_playing = false; 626 | break; 627 | } 628 | } 629 | } 630 | 631 | 632 | //----------------------------------------------- 633 | // Stop playing a score 634 | //----------------------------------------------- 635 | 636 | void Playtune::tune_stopscore (void) { 637 | int i; 638 | for (i=0; i<_tune_num_chans; ++i) 639 | tune_stopnote(i); 640 | Playtune::tune_playing = false; 641 | } 642 | 643 | 644 | //----------------------------------------------- 645 | // Delay a specified number of milliseconds 646 | //----------------------------------------------- 647 | 648 | 649 | void Playtune::tune_delay (unsigned duration) { 650 | 651 | // We provide this because using timer 0 breaks the Arduino delay() function. 652 | // We compute the toggle count based on whatever frequency the timer used for 653 | // score waits is running at. If the frequency of that timer changes, the 654 | // toggle count will be adjusted by the interrupt routine. 655 | 656 | boolean notdone; 657 | 658 | noInterrupts(); 659 | delay_toggle_count = ((unsigned long) wait_timer_frequency2 * duration + 500) / 1000; 660 | doing_delay = true; 661 | interrupts(); 662 | do { // wait until the interrupt routines decrements the toggle count to zero 663 | noInterrupts(); 664 | notdone = delay_toggle_count != 0; /* interrupt-safe test */ 665 | interrupts(); 666 | } 667 | while (notdone); 668 | doing_delay = false; 669 | } 670 | 671 | //----------------------------------------------- 672 | // Stop all channels 673 | //----------------------------------------------- 674 | 675 | void Playtune::tune_stopchans(void) { 676 | byte chan; 677 | byte timer_num; 678 | 679 | for (chan=0; chan<_tune_num_chans; ++chan) { 680 | timer_num = pgm_read_byte(tune_pin_to_timer_PGM + chan); 681 | switch (timer_num) { 682 | 683 | #if !defined(__AVR_ATmega8__) 684 | case 0: 685 | TIMSK0 &= ~(1 << OCIE0A); // disable all timer interrupts 686 | break; 687 | #endif 688 | case 1: 689 | TIMSK1 &= ~(1 << OCIE1A); 690 | break; 691 | case 2: 692 | TIMSK2 &= ~(1 << OCIE2A); 693 | break; 694 | 695 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 696 | case 3: 697 | TIMSK3 &= ~(1 << OCIE3A); 698 | break; 699 | case 4: 700 | TIMSK4 &= ~(1 << OCIE4A); 701 | break; 702 | case 5: 703 | TIMSK5 &= ~(1 << OCIE5A); 704 | break; 705 | #endif 706 | } 707 | digitalWrite(_tune_pins[chan], 0); 708 | } 709 | _tune_num_chans = 0; 710 | } 711 | 712 | //----------------------------------------------- 713 | // Timer interrupt Service Routines 714 | //----------------------------------------------- 715 | 716 | 717 | #if !defined(__AVR_ATmega8__) && !TESLA_COIL // TIMER 0 718 | ISR(TIMER0_COMPA_vect) { 719 | *timer0_pin_port ^= timer0_pin_mask; // toggle the pin 720 | } 721 | #endif 722 | 723 | #if !TESLA_COIL 724 | ISR(TIMER1_COMPA_vect) { // TIMER 1 725 | *timer1_pin_port ^= timer1_pin_mask; // toggle the pin 726 | } 727 | #endif 728 | 729 | ISR(TIMER2_COMPA_vect) { // TIMER 2 730 | 731 | // Timer 2 is the one assigned first, so we keep it running always 732 | // and use it to time score waits, whether or not it is playing a note. 733 | 734 | if (wait_timer_playing) { // toggle the pin if we're sounding a note 735 | *timer2_pin_port ^= timer2_pin_mask; 736 | #if TESLA_COIL 737 | if (*timer2_pin_port & timer2_pin_mask) teslacoil_rising_edge (2); // do a tesla coil pulse 738 | #endif 739 | } 740 | 741 | if (Playtune::tune_playing && wait_toggle_count && --wait_toggle_count == 0) { 742 | // end of a score wait, so execute more score commands 743 | wait_timer_old_frequency2 = wait_timer_frequency2; // save this timer's frequency 744 | tune_stepscore (); // execute commands 745 | // If this timer's frequency has changed and we're using it for a tune_delay(), 746 | // recompute the number of toggles to wait for 747 | if (doing_delay && wait_timer_old_frequency2 != wait_timer_frequency2) { 748 | if (delay_toggle_count >= 0x20000UL && wait_timer_frequency2 >= 0x4000U) { 749 | // Need to avoid 32-bit overflow... 750 | delay_toggle_count = ( (delay_toggle_count+4>>3) * (wait_timer_frequency2+2>>2) / wait_timer_old_frequency2 )<<5; 751 | } 752 | else { 753 | delay_toggle_count = delay_toggle_count * wait_timer_frequency2 / wait_timer_old_frequency2; 754 | } 755 | } 756 | } 757 | 758 | if (doing_delay && delay_toggle_count) --delay_toggle_count; // countdown for tune_delay() 759 | } 760 | 761 | #if defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__) 762 | 763 | ISR(TIMER3_COMPA_vect) { // TIMER 3 764 | *timer3_pin_port ^= timer3_pin_mask; // toggle the pin 765 | #if TESLA_COIL 766 | if (*timer3_pin_port & timer3_pin_mask) teslacoil_rising_edge (3); // do a tesla coil pulse 767 | #endif 768 | } 769 | 770 | ISR(TIMER4_COMPA_vect) { // TIMER 4 771 | *timer4_pin_port ^= timer4_pin_mask; // toggle the pin 772 | #if TESLA_COIL 773 | if (*timer4_pin_port & timer4_pin_mask) teslacoil_rising_edge (4); // do a tesla coil pulse 774 | #endif 775 | } 776 | 777 | ISR(TIMER5_COMPA_vect) { // TIMER 5 778 | *timer5_pin_port ^= timer5_pin_mask; // toggle the pin 779 | #if TESLA_COIL 780 | if (*timer5_pin_port & timer5_pin_mask) teslacoil_rising_edge (5); // do a tesla coil pulse 781 | #endif 782 | } 783 | 784 | #endif 785 | 786 | 787 | -------------------------------------------------------------------------------- /10 - Buzzer/Playtunes/Playtune.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Playtune: An Arduino Tune Generator 4 | * 5 | * Plays a polyphonic musical score 6 | * For documentation, see the Playtune.cpp source code file 7 | * 8 | * (C) Copyright 2011, Len Shustek 9 | * 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of version 3 of the GNU General Public License as 12 | * published by the Free Software Foundation at http://www.gnu.org/licenses, 13 | * with Additional Permissions under term 7(b) that the original copyright 14 | * notice and author attibution must be preserved and under term 7(c) that 15 | * modified versions be marked as different from the original. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * This was inspired by and adapted from "A Tone Generator Library", 23 | * written by Brett Hagman, http://www.roguerobotics.com/ 24 | * 25 | **************************************************************************/ 26 | /* 27 | * Change log 28 | * 19 January 2011, L.Shustek, V1.0: Initial release. 29 | * 10 June 2013, L. Shustek, V1.3 30 | * - change to be compatible with Arduino IDE version 1.0.5 31 | */ 32 | 33 | #ifndef Playtune_h 34 | #define Playtune_h 35 | 36 | #include 37 | 38 | class Playtune 39 | { 40 | public: 41 | void tune_initchan (byte pin); // assign a timer to an output pin 42 | void tune_playscore (byte *score); // start playing a polyphonic score 43 | volatile static boolean tune_playing; // is the score still playing? 44 | void tune_stopscore (void); // stop playing the score 45 | void tune_delay (unsigned msec); // delay in milliseconds 46 | void tune_stopchans (void); // stop all timers 47 | }; 48 | 49 | #endif -------------------------------------------------------------------------------- /10 - Buzzer/Star_Wars/Star_Wars.ino: -------------------------------------------------------------------------------- 1 | const int c = 261; 2 | const int d = 294; 3 | const int e = 329; 4 | const int f = 349; 5 | const int g = 391; 6 | const int gS = 415; 7 | const int a = 440; 8 | const int aS = 455; 9 | const int b = 466; 10 | const int cH = 523; 11 | const int cSH = 554; 12 | const int dH = 587; 13 | const int dSH = 622; 14 | const int eH = 659; 15 | const int fH = 698; 16 | const int fSH = 740; 17 | const int gH = 784; 18 | const int gSH = 830; 19 | const int aH = 880; 20 | 21 | const int buzzerPin = 8; 22 | const int ledPin1 = 12; 23 | const int ledPin2 = 13; 24 | 25 | int counter = 0; 26 | 27 | void setup() 28 | { 29 | //Setup pin modes 30 | pinMode(buzzerPin, OUTPUT); 31 | pinMode(ledPin1, OUTPUT); 32 | pinMode(ledPin2, OUTPUT); 33 | } 34 | 35 | void loop() 36 | { 37 | 38 | //Play first section 39 | firstSection(); 40 | 41 | //Play second section 42 | secondSection(); 43 | 44 | //Variant 1 45 | beep(f, 250); 46 | beep(gS, 500); 47 | beep(f, 350); 48 | beep(a, 125); 49 | beep(cH, 500); 50 | beep(a, 375); 51 | beep(cH, 125); 52 | beep(eH, 650); 53 | 54 | delay(500); 55 | 56 | //Repeat second section 57 | secondSection(); 58 | 59 | //Variant 2 60 | beep(f, 250); 61 | beep(gS, 500); 62 | beep(f, 375); 63 | beep(cH, 125); 64 | beep(a, 500); 65 | beep(f, 375); 66 | beep(cH, 125); 67 | beep(a, 650); 68 | 69 | delay(650); 70 | } 71 | 72 | void beep(int note, int duration) 73 | { 74 | //Play tone on buzzerPin 75 | tone(buzzerPin, note, duration); 76 | 77 | //Play different LED depending on value of 'counter' 78 | if(counter % 2 == 0) 79 | { 80 | digitalWrite(ledPin1, HIGH); 81 | delay(duration); 82 | digitalWrite(ledPin1, LOW); 83 | }else 84 | { 85 | digitalWrite(ledPin2, HIGH); 86 | delay(duration); 87 | digitalWrite(ledPin2, LOW); 88 | } 89 | 90 | //Stop tone on buzzerPin 91 | noTone(buzzerPin); 92 | 93 | delay(50); 94 | 95 | //Increment counter 96 | counter++; 97 | } 98 | 99 | void firstSection() 100 | { 101 | beep(a, 500); 102 | beep(a, 500); 103 | beep(a, 500); 104 | beep(f, 350); 105 | beep(cH, 150); 106 | beep(a, 500); 107 | beep(f, 350); 108 | beep(cH, 150); 109 | beep(a, 650); 110 | 111 | delay(500); 112 | 113 | beep(eH, 500); 114 | beep(eH, 500); 115 | beep(eH, 500); 116 | beep(fH, 350); 117 | beep(cH, 150); 118 | beep(gS, 500); 119 | beep(f, 350); 120 | beep(cH, 150); 121 | beep(a, 650); 122 | 123 | delay(500); 124 | } 125 | 126 | void secondSection() 127 | { 128 | beep(aH, 500); 129 | beep(a, 300); 130 | beep(a, 150); 131 | beep(aH, 500); 132 | beep(gSH, 325); 133 | beep(gH, 175); 134 | beep(fSH, 125); 135 | beep(fH, 125); 136 | beep(fSH, 250); 137 | 138 | delay(325); 139 | 140 | beep(aS, 250); 141 | beep(dSH, 500); 142 | beep(dH, 325); 143 | beep(cSH, 175); 144 | beep(cH, 125); 145 | beep(b, 125); 146 | beep(cH, 250); 147 | 148 | delay(350); 149 | } 150 | -------------------------------------------------------------------------------- /11 - 7 Segment/7_segment_sema_baglanti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/7_segment_sema_baglanti.bmp -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment-Potans/Yedi-Segment-Potans.ino: -------------------------------------------------------------------------------- 1 | 2 | int a = 2; 3 | int b = 3; 4 | int c = 4; 5 | int d = 5; 6 | int e = 6; 7 | int f = 7; 8 | int g = 8; 9 | int h = 9; 10 | 11 | int pin = A0; // Potans 12 | 13 | void setup() { 14 | pinMode(a, OUTPUT); 15 | pinMode(b, OUTPUT); 16 | pinMode(c, OUTPUT); 17 | pinMode(d, OUTPUT); 18 | pinMode(e, OUTPUT); 19 | pinMode(f, OUTPUT); 20 | pinMode(g, OUTPUT); 21 | pinMode(h, OUTPUT); 22 | } 23 | 24 | void loop() { 25 | for(int i = 0; i < 10; i++){ 26 | yazdir(i); 27 | 28 | // Potanstan okuma yaparak hız ayarlama 29 | delay(analogRead(A0)); 30 | } 31 | } 32 | 33 | void yazdir(int sayi) { 34 | switch (sayi) { 35 | case 1: 36 | digitalWrite(a, LOW); 37 | digitalWrite(b, HIGH); 38 | digitalWrite(c, HIGH); 39 | digitalWrite(d, LOW); 40 | digitalWrite(e, LOW); 41 | digitalWrite(f, LOW); 42 | digitalWrite(g, LOW); 43 | digitalWrite(h, LOW); 44 | break; 45 | 46 | case 2: 47 | digitalWrite(a, HIGH); 48 | digitalWrite(b, HIGH); 49 | digitalWrite(c, LOW); 50 | digitalWrite(d, HIGH); 51 | digitalWrite(e, HIGH); 52 | digitalWrite(f, LOW); 53 | digitalWrite(g, HIGH); 54 | digitalWrite(h, LOW); 55 | break; 56 | 57 | case 3: 58 | digitalWrite(a, HIGH); 59 | digitalWrite(b, HIGH); 60 | digitalWrite(c, HIGH); 61 | digitalWrite(d, HIGH); 62 | digitalWrite(e, LOW); 63 | digitalWrite(f, LOW); 64 | digitalWrite(g, HIGH); 65 | digitalWrite(h, LOW); 66 | break; 67 | 68 | case 4: 69 | digitalWrite(a, LOW); 70 | digitalWrite(b, HIGH); 71 | digitalWrite(c, HIGH); 72 | digitalWrite(d, LOW); 73 | digitalWrite(e, LOW); 74 | digitalWrite(f, HIGH); 75 | digitalWrite(g, HIGH); 76 | digitalWrite(h, LOW); 77 | break; 78 | 79 | case 5: 80 | digitalWrite(a, HIGH); 81 | digitalWrite(b, LOW); 82 | digitalWrite(c, HIGH); 83 | digitalWrite(d, HIGH); 84 | digitalWrite(e, LOW); 85 | digitalWrite(f, HIGH); 86 | digitalWrite(g, HIGH); 87 | digitalWrite(h, LOW); 88 | break; 89 | 90 | case 6: 91 | digitalWrite(a, HIGH); 92 | digitalWrite(b, LOW); 93 | digitalWrite(c, HIGH); 94 | digitalWrite(d, HIGH); 95 | digitalWrite(e, HIGH); 96 | digitalWrite(f, HIGH); 97 | digitalWrite(g, HIGH); 98 | digitalWrite(h, LOW); 99 | break; 100 | 101 | case 7: 102 | digitalWrite(a, HIGH); 103 | digitalWrite(b, HIGH); 104 | digitalWrite(c, HIGH); 105 | digitalWrite(d, LOW); 106 | digitalWrite(e, LOW); 107 | digitalWrite(f, LOW); 108 | digitalWrite(g, LOW); 109 | digitalWrite(h, LOW); 110 | break; 111 | 112 | case 8: 113 | digitalWrite(a, HIGH); 114 | digitalWrite(b, HIGH); 115 | digitalWrite(c, HIGH); 116 | digitalWrite(d, HIGH); 117 | digitalWrite(e, HIGH); 118 | digitalWrite(f, HIGH); 119 | digitalWrite(g, HIGH); 120 | digitalWrite(h, LOW); 121 | break; 122 | 123 | case 9: 124 | digitalWrite(a, HIGH); 125 | digitalWrite(b, HIGH); 126 | digitalWrite(c, HIGH); 127 | digitalWrite(d, HIGH); 128 | digitalWrite(e, LOW); 129 | digitalWrite(f, HIGH); 130 | digitalWrite(g, HIGH); 131 | digitalWrite(h, LOW); 132 | break; 133 | 134 | case 0: 135 | digitalWrite(a, HIGH); 136 | digitalWrite(b, HIGH); 137 | digitalWrite(c, HIGH); 138 | digitalWrite(d, HIGH); 139 | digitalWrite(e, HIGH); 140 | digitalWrite(f, HIGH); 141 | digitalWrite(g, LOW); 142 | digitalWrite(h, LOW); 143 | break; 144 | } 145 | } 146 | 147 | -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment-Potans/Yedi_Segment_Potans.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/Yedi-Segment-Potans/Yedi_Segment_Potans.fzz -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment-Potans/Yedi_Segment_Potans.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/Yedi-Segment-Potans/Yedi_Segment_Potans.jpg -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment-Sayac/Yedi-Segment-Sayac.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/Yedi-Segment-Sayac/Yedi-Segment-Sayac.fzz -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment-Sayac/Yedi-Segment-Sayac.ino: -------------------------------------------------------------------------------- 1 | 2 | int a = 2; 3 | int b = 3; 4 | int c = 4; 5 | int d = 5; 6 | int e = 6; 7 | int f = 7; 8 | int g = 8; 9 | int h = 9; 10 | 11 | int button = 10; 12 | int sayac = 0; 13 | 14 | void setup() { 15 | pinMode(a, OUTPUT); 16 | pinMode(b, OUTPUT); 17 | pinMode(c, OUTPUT); 18 | pinMode(d, OUTPUT); 19 | pinMode(e, OUTPUT); 20 | pinMode(f, OUTPUT); 21 | pinMode(g, OUTPUT); 22 | pinMode(h, OUTPUT); 23 | 24 | pinMode(button, INPUT); 25 | yazdir(0); 26 | } 27 | 28 | void loop() { 29 | int gelenDeger = digitalRead(button); 30 | if (gelenDeger == HIGH) { 31 | sayac++; 32 | yazdir( sayac % 10 ); 33 | } 34 | Serial.println(sayac); 35 | delay(200); 36 | } 37 | 38 | void yazdir(int sayi) { 39 | switch (sayi) { 40 | case 1: 41 | digitalWrite(a, LOW); 42 | digitalWrite(b, HIGH); 43 | digitalWrite(c, HIGH); 44 | digitalWrite(d, LOW); 45 | digitalWrite(e, LOW); 46 | digitalWrite(f, LOW); 47 | digitalWrite(g, LOW); 48 | digitalWrite(h, LOW); 49 | break; 50 | 51 | case 2: 52 | digitalWrite(a, HIGH); 53 | digitalWrite(b, HIGH); 54 | digitalWrite(c, LOW); 55 | digitalWrite(d, HIGH); 56 | digitalWrite(e, HIGH); 57 | digitalWrite(f, LOW); 58 | digitalWrite(g, HIGH); 59 | digitalWrite(h, LOW); 60 | break; 61 | 62 | case 3: 63 | digitalWrite(a, HIGH); 64 | digitalWrite(b, HIGH); 65 | digitalWrite(c, HIGH); 66 | digitalWrite(d, HIGH); 67 | digitalWrite(e, LOW); 68 | digitalWrite(f, LOW); 69 | digitalWrite(g, HIGH); 70 | digitalWrite(h, LOW); 71 | break; 72 | 73 | case 4: 74 | digitalWrite(a, LOW); 75 | digitalWrite(b, HIGH); 76 | digitalWrite(c, HIGH); 77 | digitalWrite(d, LOW); 78 | digitalWrite(e, LOW); 79 | digitalWrite(f, HIGH); 80 | digitalWrite(g, HIGH); 81 | digitalWrite(h, LOW); 82 | break; 83 | 84 | case 5: 85 | digitalWrite(a, HIGH); 86 | digitalWrite(b, LOW); 87 | digitalWrite(c, HIGH); 88 | digitalWrite(d, HIGH); 89 | digitalWrite(e, LOW); 90 | digitalWrite(f, HIGH); 91 | digitalWrite(g, HIGH); 92 | digitalWrite(h, LOW); 93 | break; 94 | 95 | case 6: 96 | digitalWrite(a, HIGH); 97 | digitalWrite(b, LOW); 98 | digitalWrite(c, HIGH); 99 | digitalWrite(d, HIGH); 100 | digitalWrite(e, HIGH); 101 | digitalWrite(f, HIGH); 102 | digitalWrite(g, HIGH); 103 | digitalWrite(h, LOW); 104 | break; 105 | 106 | case 7: 107 | digitalWrite(a, HIGH); 108 | digitalWrite(b, HIGH); 109 | digitalWrite(c, HIGH); 110 | digitalWrite(d, LOW); 111 | digitalWrite(e, LOW); 112 | digitalWrite(f, LOW); 113 | digitalWrite(g, LOW); 114 | digitalWrite(h, LOW); 115 | break; 116 | 117 | case 8: 118 | digitalWrite(a, HIGH); 119 | digitalWrite(b, HIGH); 120 | digitalWrite(c, HIGH); 121 | digitalWrite(d, HIGH); 122 | digitalWrite(e, HIGH); 123 | digitalWrite(f, HIGH); 124 | digitalWrite(g, HIGH); 125 | digitalWrite(h, LOW); 126 | break; 127 | 128 | case 9: 129 | digitalWrite(a, HIGH); 130 | digitalWrite(b, HIGH); 131 | digitalWrite(c, HIGH); 132 | digitalWrite(d, HIGH); 133 | digitalWrite(e, LOW); 134 | digitalWrite(f, HIGH); 135 | digitalWrite(g, HIGH); 136 | digitalWrite(h, LOW); 137 | break; 138 | 139 | case 0: 140 | digitalWrite(a, HIGH); 141 | digitalWrite(b, HIGH); 142 | digitalWrite(c, HIGH); 143 | digitalWrite(d, HIGH); 144 | digitalWrite(e, HIGH); 145 | digitalWrite(f, HIGH); 146 | digitalWrite(g, LOW); 147 | digitalWrite(h, LOW); 148 | break; 149 | } 150 | } 151 | 152 | -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment-Sayac/Yedi-Segment-Sayac.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/Yedi-Segment-Sayac/Yedi-Segment-Sayac.jpg -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment/Yedi-Segment.ino: -------------------------------------------------------------------------------- 1 | 2 | int a = 2; 3 | int b = 3; 4 | int c = 4; 5 | int d = 5; 6 | int e = 6; 7 | int f = 7; 8 | int g = 8; 9 | int h = 9; 10 | 11 | void setup() { 12 | pinMode(a, OUTPUT); 13 | pinMode(b, OUTPUT); 14 | pinMode(c, OUTPUT); 15 | pinMode(d, OUTPUT); 16 | pinMode(e, OUTPUT); 17 | pinMode(f, OUTPUT); 18 | pinMode(g, OUTPUT); 19 | pinMode(h, OUTPUT); 20 | } 21 | 22 | void loop() { 23 | for(int i = 0; i < 10; i++){ 24 | yazdir(i); 25 | delay(1000); 26 | } 27 | } 28 | 29 | void yazdir(int sayi) { 30 | switch (sayi) { 31 | case 1: 32 | digitalWrite(a, LOW); 33 | digitalWrite(b, HIGH); 34 | digitalWrite(c, HIGH); 35 | digitalWrite(d, LOW); 36 | digitalWrite(e, LOW); 37 | digitalWrite(f, LOW); 38 | digitalWrite(g, LOW); 39 | digitalWrite(h, LOW); 40 | break; 41 | 42 | case 2: 43 | digitalWrite(a, HIGH); 44 | digitalWrite(b, HIGH); 45 | digitalWrite(c, LOW); 46 | digitalWrite(d, HIGH); 47 | digitalWrite(e, HIGH); 48 | digitalWrite(f, LOW); 49 | digitalWrite(g, HIGH); 50 | digitalWrite(h, LOW); 51 | break; 52 | 53 | case 3: 54 | digitalWrite(a, HIGH); 55 | digitalWrite(b, HIGH); 56 | digitalWrite(c, HIGH); 57 | digitalWrite(d, HIGH); 58 | digitalWrite(e, LOW); 59 | digitalWrite(f, LOW); 60 | digitalWrite(g, HIGH); 61 | digitalWrite(h, LOW); 62 | break; 63 | 64 | case 4: 65 | digitalWrite(a, LOW); 66 | digitalWrite(b, HIGH); 67 | digitalWrite(c, HIGH); 68 | digitalWrite(d, LOW); 69 | digitalWrite(e, LOW); 70 | digitalWrite(f, HIGH); 71 | digitalWrite(g, HIGH); 72 | digitalWrite(h, LOW); 73 | break; 74 | 75 | case 5: 76 | digitalWrite(a, HIGH); 77 | digitalWrite(b, LOW); 78 | digitalWrite(c, HIGH); 79 | digitalWrite(d, HIGH); 80 | digitalWrite(e, LOW); 81 | digitalWrite(f, HIGH); 82 | digitalWrite(g, HIGH); 83 | digitalWrite(h, LOW); 84 | break; 85 | 86 | case 6: 87 | digitalWrite(a, HIGH); 88 | digitalWrite(b, LOW); 89 | digitalWrite(c, HIGH); 90 | digitalWrite(d, HIGH); 91 | digitalWrite(e, HIGH); 92 | digitalWrite(f, HIGH); 93 | digitalWrite(g, HIGH); 94 | digitalWrite(h, LOW); 95 | break; 96 | 97 | case 7: 98 | digitalWrite(a, HIGH); 99 | digitalWrite(b, HIGH); 100 | digitalWrite(c, HIGH); 101 | digitalWrite(d, LOW); 102 | digitalWrite(e, LOW); 103 | digitalWrite(f, LOW); 104 | digitalWrite(g, LOW); 105 | digitalWrite(h, LOW); 106 | break; 107 | 108 | case 8: 109 | digitalWrite(a, HIGH); 110 | digitalWrite(b, HIGH); 111 | digitalWrite(c, HIGH); 112 | digitalWrite(d, HIGH); 113 | digitalWrite(e, HIGH); 114 | digitalWrite(f, HIGH); 115 | digitalWrite(g, HIGH); 116 | digitalWrite(h, LOW); 117 | break; 118 | 119 | case 9: 120 | digitalWrite(a, HIGH); 121 | digitalWrite(b, HIGH); 122 | digitalWrite(c, HIGH); 123 | digitalWrite(d, HIGH); 124 | digitalWrite(e, LOW); 125 | digitalWrite(f, HIGH); 126 | digitalWrite(g, HIGH); 127 | digitalWrite(h, LOW); 128 | break; 129 | 130 | case 0: 131 | digitalWrite(a, HIGH); 132 | digitalWrite(b, HIGH); 133 | digitalWrite(c, HIGH); 134 | digitalWrite(d, HIGH); 135 | digitalWrite(e, HIGH); 136 | digitalWrite(f, HIGH); 137 | digitalWrite(g, LOW); 138 | digitalWrite(h, LOW); 139 | break; 140 | } 141 | } 142 | 143 | -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment/Yedi_Segment.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/Yedi-Segment/Yedi_Segment.fzz -------------------------------------------------------------------------------- /11 - 7 Segment/Yedi-Segment/Yedi_Segment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/11 - 7 Segment/Yedi-Segment/Yedi_Segment.jpg -------------------------------------------------------------------------------- /12 - LM35/lm 35 kodu.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/12 - LM35/lm 35 kodu.docx -------------------------------------------------------------------------------- /12 - LM35/lm35-cizim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/12 - LM35/lm35-cizim.gif -------------------------------------------------------------------------------- /12 - LM35/lm35/lm35.ino: -------------------------------------------------------------------------------- 1 | // 5V - A0 - GND yazı bize bakarken baglama 2 | const int lmPin = 1; 3 | int val =0; 4 | void setup() 5 | { 6 | Serial.begin(9600); 7 | } 8 | void loop() 9 | { 10 | val = analogRead(lmPin); 11 | float mv = ( val/1024.0)*5000; 12 | float cel = mv/10; 13 | float farh = (cel*9)/5 + 32; 14 | 15 | Serial.print("sicaklik = "); 16 | Serial.print(cel); 17 | } 18 | -------------------------------------------------------------------------------- /13 - HC SR04/DeepinScreenshot20160129010922.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/13 - HC SR04/DeepinScreenshot20160129010922.png -------------------------------------------------------------------------------- /13 - HC SR04/HCR04/HCR04.ino: -------------------------------------------------------------------------------- 1 | int trigPin = 13; 2 | int echoPin = 12; 3 | int led1 = 7; 4 | int led2 = 8; 5 | int led3 = 9; 6 | 7 | void setup() { 8 | Serial.begin (9600); 9 | pinMode(trigPin, OUTPUT); 10 | pinMode(echoPin, INPUT); 11 | pinMode(led1, OUTPUT); 12 | pinMode(led2, OUTPUT); 13 | pinMode(led3, OUTPUT); 14 | } 15 | 16 | void loop() { 17 | long sure, uzaklik; 18 | digitalWrite(trigPin, LOW); 19 | delayMicroseconds(2); 20 | digitalWrite(trigPin, HIGH); 21 | delayMicroseconds(10); 22 | digitalWrite(trigPin, LOW); 23 | sure = pulseIn(echoPin, HIGH); 24 | 25 | uzaklik = (sure/2) / 29.1; 26 | 27 | if (uzaklik >= 200 || uzaklik <= 0){ 28 | Serial.println("Olamaz, Olaamaaaz"); 29 | } 30 | else { 31 | Serial.print(uzaklik); 32 | Serial.println(" cm"); 33 | } 34 | 35 | if(uzaklik >0 && uzaklik <= 50){ 36 | digitalWrite(led1, HIGH); 37 | digitalWrite(led2, LOW); 38 | digitalWrite(led3, LOW); 39 | } 40 | else if (uzaklik >50 && uzaklik <= 100){ 41 | digitalWrite(led1, HIGH); 42 | digitalWrite(led2, HIGH); 43 | digitalWrite(led3, LOW); 44 | } 45 | else if(uzaklik >100 && uzaklik <= 200){ 46 | digitalWrite(led1, HIGH); 47 | digitalWrite(led2, HIGH); 48 | digitalWrite(led3, HIGH); 49 | } 50 | else{ 51 | digitalWrite(led1, LOW); 52 | digitalWrite(led2, LOW); 53 | digitalWrite(led3, LOW); 54 | } 55 | 56 | delay(500); 57 | } 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /13 - HC SR04/hc sr04 - led.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/13 - HC SR04/hc sr04 - led.docx -------------------------------------------------------------------------------- /14 - Kızılötesi Sensör/CNY70/CNY70.ino: -------------------------------------------------------------------------------- 1 | int pin = A1; 2 | int led = 2; 3 | int referansDeger = 100; 4 | 5 | void setup() { 6 | pinMode(pin, INPUT); 7 | pinMode(led, OUTPUT); 8 | digitalWrite(led, HIGH); 9 | Serial.begin(9600); 10 | } 11 | 12 | void loop() { 13 | int gelenDeger = analogRead(pin); 14 | Serial.print(gelenDeger + " "); 15 | 16 | if(gelenDeger > referansDeger){ 17 | Serial.println("Beyaz"); 18 | } 19 | else { 20 | Serial.println("Siyah"); 21 | } 22 | delay(10); 23 | } 24 | -------------------------------------------------------------------------------- /14 - Kızılötesi Sensör/cny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/14 - Kızılötesi Sensör/cny.png -------------------------------------------------------------------------------- /14 - Kızılötesi Sensör/cny70.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/14 - Kızılötesi Sensör/cny70.odt -------------------------------------------------------------------------------- /15 - Kendi Ardunomuzu Yapalım/atmega.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/15 - Kendi Ardunomuzu Yapalım/atmega.png -------------------------------------------------------------------------------- /15 - Kendi Ardunomuzu Yapalım/atmega328p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/15 - Kendi Ardunomuzu Yapalım/atmega328p.png -------------------------------------------------------------------------------- /15 - Kendi Ardunomuzu Yapalım/bootloader.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/15 - Kendi Ardunomuzu Yapalım/bootloader.odt -------------------------------------------------------------------------------- /15 - Kendi Ardunomuzu Yapalım/bootloader2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/15 - Kendi Ardunomuzu Yapalım/bootloader2.png -------------------------------------------------------------------------------- /15 - Kendi Ardunomuzu Yapalım/breadboard-arduino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/15 - Kendi Ardunomuzu Yapalım/breadboard-arduino.jpg -------------------------------------------------------------------------------- /15 - Kendi Ardunomuzu Yapalım/programming.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/15 - Kendi Ardunomuzu Yapalım/programming.odt -------------------------------------------------------------------------------- /16 - Haberleşme Protokolleri/Arduino_Haberlesme1/Arduino_Haberlesme1.ino: -------------------------------------------------------------------------------- 1 | int led = 6; 2 | 3 | void setup() { 4 | Serial.begin(9600); 5 | pinMode(led, OUTPUT); 6 | } 7 | 8 | void loop() { 9 | if (Serial.available() > 0) { 10 | Serial.print(Serial.readString()); 11 | } 12 | } -------------------------------------------------------------------------------- /16 - Haberleşme Protokolleri/Arduino_Haberlesme2/Arduino_Haberlesme2.ino: -------------------------------------------------------------------------------- 1 | int led = 6; 2 | 3 | void setup() { 4 | Serial.begin(9600); 5 | pinMode(led, OUTPUT); 6 | } 7 | 8 | void loop() { 9 | if (Serial.available() > 0) { 10 | String gelen = Serial.read(); 11 | if(gelen == '1'){ 12 | digitalWrite(led, HIGH); 13 | } 14 | else if (gelen == '0'){ 15 | digitalWrite(led, LOW); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /16 - Haberleşme Protokolleri/haberleşme protokolleri.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/16 - Haberleşme Protokolleri/haberleşme protokolleri.odt -------------------------------------------------------------------------------- /17 - Motor Uygulama/L293D-with-motors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/17 - Motor Uygulama/L293D-with-motors.png -------------------------------------------------------------------------------- /17 - Motor Uygulama/motor/motor.ino: -------------------------------------------------------------------------------- 1 | int mtr1_a = 3; // Sol Ön 2 | int mtr1_b = 4; // Sol Arka 3 | int mtr2_a = 5; // Sağ ön 4 | int mtr2_b = 6; // Sağ arka 5 | 6 | void setup() { 7 | pinMode(mtr1_a, OUTPUT); 8 | pinMode(mtr1_b, OUTPUT); 9 | pinMode(mtr2_a, OUTPUT); 10 | pinMode(mtr2_b, OUTPUT); 11 | Serial.begin(9600); 12 | } 13 | 14 | void loop() { 15 | if(Serial.available() > 0){ 16 | 17 | String gelen = Serial.readString(); 18 | 19 | if (gelen == "2") 20 | ileri(); 21 | else if (gelen == "8") 22 | geri(); 23 | else if (gelen == "4") 24 | sol(); 25 | else if (gelen == "6") 26 | sag(); 27 | else if (gelen == "0") 28 | dur(); 29 | } 30 | } 31 | 32 | void ileri(){ 33 | digitalWrite(mtr1_a, 1); 34 | digitalWrite(mtr1_b, 0); 35 | digitalWrite(mtr2_a, 1); 36 | digitalWrite(mtr2_b, 0); 37 | } 38 | void geri(){ 39 | digitalWrite(mtr1_a, 0); 40 | digitalWrite(mtr1_b, 1); 41 | digitalWrite(mtr2_a, 0); 42 | digitalWrite(mtr2_b, 1); 43 | } 44 | void dur(){ 45 | digitalWrite(mtr1_a, 0); 46 | digitalWrite(mtr1_b, 0); 47 | digitalWrite(mtr2_a, 0); 48 | digitalWrite(mtr2_b, 0); 49 | } 50 | void sol(){ 51 | digitalWrite(mtr1_a, 0); 52 | digitalWrite(mtr1_b, 0); 53 | digitalWrite(mtr2_a, 1); 54 | digitalWrite(mtr2_b, 0); 55 | } 56 | void sag(){ 57 | digitalWrite(mtr1_a, 1); 58 | digitalWrite(mtr1_b, 0); 59 | digitalWrite(mtr2_a, 0); 60 | digitalWrite(mtr2_b, 0); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/01 - Scratch Program Tanıtımı.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/01 - Scratch Program Tanıtımı.pdf -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/02 - Tübitak Scratch Kitabı.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/02 - Tübitak Scratch Kitabı.pdf -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/03 - Scratch ile Arduino Programlama.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/03 - Scratch ile Arduino Programlama.pdf -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/04 - Scratch Kısa Notlar.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/04 - Scratch Kısa Notlar.pdf -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/23NİSAN.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/23NİSAN.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/HOKEY.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/HOKEY.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/LABİRENT_SINAV.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/LABİRENT_SINAV.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/Oyun_ZOR_.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/Oyun_ZOR_.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/balıklar Hareket kodları.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/balıklar Hareket kodları.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/cizim yap.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/cizim yap.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/damga.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/damga.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/emoji oyunu.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/emoji oyunu.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/ilk_KODlarımız.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/ilk_KODlarımız.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/karakterini çiz.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/karakterini çiz.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/pacman.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/pacman.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/top oyunu.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/top oyunu.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/zor oyunu.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/zor oyunu.sb -------------------------------------------------------------------------------- /BONUS - Scratch Uygulamaları/Scratch Uygulamalar/çarpma işlemi.sb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serhattsnmz/Arduino-Notlar/a73f60a74e653c62db4310a28b0b1cd0cc9c4e85/BONUS - Scratch Uygulamaları/Scratch Uygulamalar/çarpma işlemi.sb -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Arduino Ders Notları 2 | 3 | - Arduino kusunda verilen derslerin şemaları ve program kodları 4 | 5 | ## Eğitim İçeriği 6 | 7 | **Yapılması planlanan uygulamalar:** 8 | 9 | - Temel elektronik bilgisi ve kullanılacak malzemelerin tanıtılması 10 | - Arduino IDE arayüzü ve çalışma yapısının anlatılması 11 | - Temel uygulamalar(LED yakma, buton vb.) 12 | - Seri port, PWM uygulamaları 13 | - Arduino ile bilgisayar haberleşmesi 14 | - Ultrasonik sensör ile mesafe ölçümü 15 | - Arduino ile DC motor hız ve yön kontrolü 16 | - Servo motor kontrolü 17 | - Bilgisayardan servo motor ve DC motor kontrolü 18 | - RGB LED’ler ile farklı renklerin elde edilmesi 19 | - Bilgisayardan RGB LED’in renk kontrolü 20 | - 7 Segment’in yapısı ve kullanımı 21 | - Arduino ile HC06 Bluetooth Modül Kullanımı 22 | 23 | ## Malzeme Listesi 24 | 25 | | MALZEME | MİN MİKTAR | AÇIKLAMA | 26 | | --------------------- | ------------- | --------- | 27 | | Kişisel Bilgisayar | | Arduino IDE programı kurulu olmalıdır. | 28 | | Arduino UNO | 1 adet | Arduino'nun diğer modelleri eğitim için tavsiye edilmez. | 29 | | Breadboard | 1 adet | Küçük olmamasına özen gösterilmeli. | 30 | | Jumper Kablo | 30 adet | İki ucu erkek olmalı. | 31 | | Krokodil | 4 adet | | 32 | | 9V Pil | 2 adet | | 33 | | 9V Pil Başlığı | 2 adet | | 34 | | Direnç | 10'ar adet | 100 - 220 - 330 - 1k - 4.7k - 10k - 47k ohm dirençleri. | 35 | | Potansiyometre | 2 adet | 10k ohm | 36 | | LED | 10'ar adet | Kırmızı - Mavi - Yeşil renklerde | 37 | | RGB LED | 2 adet | | 38 | | Button | 10 adet | 2 veya 4 bacaklı olabilir. | 39 | | Buzzer | 1 adet | | 40 | | 7 Segment Display | 2 adet | | 41 | | BC237 | 10 adet | | 42 | | 7805 Regulator | 1 adet | | 43 | | HC-SR04 Sensör | 1 adet | | 44 | | LM35 Sensör | 1 adet | | 45 | | LDR direnç | 4 adet | | 46 | | LCD 1602 Monitor | 1 adet | | 47 | | LCD I2C Dönüştürücü | 1 adet | | 48 | | Hc06 Bluetooth Modül | 1 adet | | 49 | | Servo motor | 1 adet | 9g | 50 | | DC Motor | 2 adet | | 51 | | L293D Motor Sürücü | 1 adet | | 52 | 53 | ## Robot Malzemeleri 54 | 55 | | MALZEME | MİN MİKTAR | AÇIKLAMA | 56 | | --------------------- | ------------- | --------- | 57 | | Araba Robot Gövdesi | 1 adet | İki tekerlek ve bir sarhoş tekerlek takılabilecek robot gövdesi | 58 | | Tekerlek | 2 adet | Aldığınız motora uygun olmalı. | 59 | | Sarhoş tekerlek | 1 adet | Gövde ve tekerleklere uyumlu olmalı. | --------------------------------------------------------------------------------