Mundarija:

Rokola Luis Ernandes va Ignasio Kasado: 7 qadam
Rokola Luis Ernandes va Ignasio Kasado: 7 qadam

Video: Rokola Luis Ernandes va Ignasio Kasado: 7 qadam

Video: Rokola Luis Ernandes va Ignasio Kasado: 7 qadam
Video: Caso Cerrado Complete Case | I sued my 7 year-old sister 👧🏼📙👦🏻 2024, Noyabr
Anonim
Rokola Luis Ernandes va Ignasio Kasado
Rokola Luis Ernandes va Ignasio Kasado

Bu, Garri Potter va Luis Fonsining Despacito de la canciones mavzusiga tegishli.

1 -qadam: Materiallar

1 Protoboard

1 Arduino UNO

kabellar jumper-gambra va macho-macho

1 pantalla LCD 16x2

2 Buzzer pasivo

2 tugmachasi

Arduino uchun 1 ta USB kabeli

Tashqi tomondan 1 -sonli

2 -qadam: Dastur

Dastur
Dastur
Dastur
Dastur

Boshlang'ich, LCD -biblioteka dasturlari, dasturlar va dasturlarning konfiguratsiyasini ta'minlaydi. Ma'lum bo'lishicha, har qanday o'zgaruvchini aniqlasangiz, qarag'ayni ham, botonni ham, qarama-qarshi "derramalarga qarshi" ham o'zgarmas.

#qo'shing

// kutubxonalar uchun LCD displey

LiquidCrystal lcd (12, 11, 5, 4, 3, 2); // Indica que pines se estan utilizando

int cantidad = 0;

const int botonI = 10; const int botonD = 9; int antiderrames = 0; // o'zgarmaydigan va o'zgaruvchan LCD displey 3 -o'rinda, buzzer_pin = 6;

Después de eso, hay que nombrar a las funciones que van a:

  1. Mashinani aniqlang (buzzer signallari, nota y la duración de la misma).
  2. Ta'rif las notas (en letras), dándoles un valor único de Hz.
  3. Ta'rif la las notas (nota, yarim nota va boshqalar).

Yo'q, eng yuqori tezlik

void setTone (int pin, int note, int duration) {ohang (pin, nota, davomiylik); kechikish (davomiyligi); noTone (pin); } MusicStruct tuzilishi {int A = 550; int As = 582; int B = 617; int C = 654; int Cs = 693; int D = 734; int Ds = 777; int E = 824; int F = 873; int Fs = 925; int G = 980; int Gs = 1003; int A2 = 1100; int A2s = 1165; int B2 = 1234; int C3 = 1308; int C3s = 1385; int D3 = 1555; } Musiqa; struct LengthStruct {float half = 0.5; float one = 1.0; float one_half = 1,5; float two = 2.0; float two_half = 2.5; } Uzunlik;

int tempi = 400; // velocidad de la kompozitsiya

Después de definir todo eso, podemos empezar la parte interesante dastur.

Primero, pichan navbat:

  • Serial monitor
  • Ta'rif los modos de los pines de los botones y el buzzer
  • Rasmiy LCD displeyni oching va kursorni ishga tushiring

void setup () {Serial.begin (9600); pinMod (botonI, INPUT_PULLUP); pinMode (botonD, INPUT_PULLUP);

// LCD displeyi

lcd.begin (16, 2); // Eng yuqori darajadagi lcd.clear (); lcd.setCursor (0, 0); // 0, 0 pinMode (buzzer_pin, OUTPUT);

}

Lac funciones las funciones de las funciones, que van a dar el orden, tono, tasempo de las 2 canciones to the tener en este proyecto (despacito y el tema main de Harry Potter).

Usaremos 2 toccar canciones en este proyecto:

  1. UsTando la función setTone, aniq ta'riflar (Garri Potter)
  2. Arduino ovozini buzish funktsiyasi (Despacito)

Eslatmalar: 856 -yillarning 12 -chi kunlari, birinchi navbatda, asosiy vazifalar

void jarri () {setTone (buzzer_pin, Music. B, temp * Length.one); setTone (buzzer_pin, Music. E, temp * Length.one_half); setTone (buzzer_pin, Music. G, temp * Length.half); setTone (buzzer_pin, Music. F, temp * Length.one); setTone (buzzer_pin, Music. E, temp * Length.two); setTone (buzzer_pin, Music. B2, temp * Length.one); setTone (buzzer_pin, Music. A2, temp * Length.two_half); setTone (buzzer_pin, Music. Fs, temp * Length.two_half); setTone (buzzer_pin, Music. E, temp * Length.one_half); setTone (buzzer_pin, Music. G, temp * Length.half); setTone (buzzer_pin, Music. F, temp * Length.one); setTone (buzzer_pin, Music. Ds, temp * Length.two); setTone (buzzer_pin, Music. F, temp * Length.one); setTone (buzzer_pin, Music. B, temp * Length.two_half);} bo'sh Despacito () {ohang (buzzer_pin, 587, 709.720327982); kechikish (788.578142202); kechikish (10.3082110092); ohang (buzzer_pin, 554, 709.720327982); kechikish (788.578142202); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 369, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 440, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 391, 412.843850917); kechikish (458.715389908); kechikish (5.15410550459); ohang (buzzer_pin, 391, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 391, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 391, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 391, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 391, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 554, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 587, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 440, 412.843850917); kechikish (458.715389908); kechikish (5.15410550459); ohang (buzzer_pin, 440, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 440, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 440, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 440, 41.7482545872); kechikish (46.3869495413); kechikish (36.0787385321); ohang (buzzer_pin, 440, 37.109559633); kechikish (41.2328440367); kechikish (30.9246330275); ohang (buzzer_pin, 440, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 587, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 587, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 587, 46.3869495413); kechikish (51.5410550459); kechikish (30.9246330275); ohang (buzzer_pin, 587, 46.3869495413); kechikish (51.5410550459); kechikish (20.6164220183); ohang (buzzer_pin, 587, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 659, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 659, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 554, 691.165548165); kechikish (767.961720183); kechikish (314.40043578); ohang (buzzer_pin, 587, 552.004699541); kechikish (613.338555046); kechikish (5.15410550459); ohang (buzzer_pin, 554, 552.004699541); kechikish (613.338555046); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 369, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 369, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 46.3869495413); kechikish (51.5410550459); kechikish (30.9246330275); ohang (buzzer_pin, 493, 46.3869495413); kechikish (51.5410550459); kechikish (20.6164220183); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); ohang (buzzer_pin, 440, 134.52215367); kechikish (149.469059633); kechikish (5.15410550459); ohang (buzzer_pin, 493, 273.683002294); kechikish (304.092224771); kechikish (5.15410550459); }

Bu juda muhim dastur, Arduino dasturining eng muhim qismi … va Loop ()

Boshlang'ich ta'rifi llamado leibel (especcacular nombre, lo sé), a loop in a del inicio del loop () cuando termine cada canción. Tushunarsizki, bu o'zgarmaydigan derazalarga qarshilik ko'rsatishga imkon beradi, bu esa LCD displeyni juda yaxshi tushunishga imkon beradi.

Ma'lum bo'lishicha, bu sizning qo'lingizdan kelganini biladi.

void loop () {leibel: if ((antiderrames == 0) && (digitalRead (botonI) == 1) && (digitalRead (botonD) == 1)) {lcd.setCursor (0, 0); lcd.print ("Elegir cancion"); // CAMBIA el icono lcd.setCursor (0, 1); lcd.print ("1 o 2"); } else {if (digitalRead (botonI) == 0) {kechiktirish (400); lcd.clear (); if (cantidad == 0) {cantidad = 1; } qarshi dasturlar ++; } if (digitalRead (botonD) == 0) {kechiktirish (400); lcd.clear (); if (cantidad == 1) {cantidad = 0; } qarshi dasturlar ++; } if (cantidad == 0) {lcd.setCursor (0, 0); lcd.print ("Garri Potter"); // CAMBIA el icono lcd.setCursor (0, 1); lcd.print ("Mavzu"); jarri (); qarshi dasturlar = 0; lcd.clear (); goto leibel; // volvemos al inicio

}

aks holda (cantidad == 1); {

lcd.setCursor (0, 0); lcd.print ("Despacito"); // CAMBIA el icono lcd.setCursor (0, 1); lcd.print ("Luis Fonsi"); Despacito (); qarshi dasturlar = 0; lcd.clear (); goto leibel; // volvemos al inicio}}}

Dastur LCD displey 16x2 o'lchamlari bilan yakuniy vazifani bajaradi, bu esa final dasturini himoya qilish uchun mo'ljallangan.

3 -qadam: 4. Escoger Canciones dasturi bo'yicha

4. Escoger Canciones dasturi bo'yicha
4. Escoger Canciones dasturi bo'yicha
4. Escoger Canciones dasturi bo'yicha
4. Escoger Canciones dasturi bo'yicha

2 -toifali dasturlar, shuningdek, rokola uchun mo'ljallangan. Garri Potter "Despacito" va Luis Fonsi uchun eng mashhur o'yinlardan biri.

4 -qadam: Unir dasturlari

Unir dasturlari
Unir dasturlari

Después de tener la programación de los botones, la pantalla y las canciones; u bir vaqtning o'zida bir -biriga mos keladimi yoki yo'qmi, modifikatsiya qilingan.

5 -qadam: Fisikoga aylantiring

Fisikoga aylantiring
Fisikoga aylantiring
Fisikoga aylantiring
Fisikoga aylantiring

Kompyuterni ishga tushirish tugmachalari, shuningdek, qo'shimcha qurilmalar uchun natijalar. Embargo, garchi qurol -yarog 'ocurrió un inconveniente, yoki hech qanday aloqasi yo'q bo'lsa, biz hech qanday aloqaga ega bo'lmaymiz. Eslatib o'tamiz, botoniyalar va ovozli signallarning yakka qismi.

6 -qadam: Máquinas Utilizadas

Utilizadalar mashinasi
Utilizadalar mashinasi

Siz Maker-Space-ni yaratganingizdan so'ng, siz o'zingizning shaxsiy ma'lumotlaringizni o'chirib qo'yishingiz mumkin.

Stikerni yopishtirish uchun stikerlarni ishlating

Maker-makonni yaratish uchun poydevorni o'rnatib qo'ying, chunki u ovozli signal va Arduino kabelini ishlatadi.

7 -qadam: Tavsiyalar

Tavsiyalar
Tavsiyalar

Olingan natijalar quyidagicha tavsiya etiladi:

- Tinkercad -ning asosiy funktsiyalari uchun dasturning oldingi versiyasi. Bu erda kabellar va protokollar mavjud.

- Aloqa ma'lumotlari, shuningdek, komponentlar bilan bog'lanish.

- Tinkercad -ni qayta tiklash uchun hech qanday imkoniyat yo'q.

- O'lchovlarni o'lchash uchun, bu juda katta hajmda.

Tavsiya: