Mundarija:

Jukebox + Arduino: 5 qadam
Jukebox + Arduino: 5 qadam

Video: Jukebox + Arduino: 5 qadam

Video: Jukebox + Arduino: 5 qadam
Video: Kadam Lyrical Video Song | Karwaan | Irrfan Khan, Dulquer Salmaan, Mithila Palkar | Prateek Kuhad 2024, Noyabr
Anonim
Musiqa qutisi + Arduino
Musiqa qutisi + Arduino

Bu Rocola Digital va Arduino dasturlarining bir qismi hisoblanadi. Bu juda oddiy, lekin hech qanday farq yo'q. La Rocola tiene muchas funciones interesantes, a LCD displeylar bir vaqtning o'zida LCD displeyda, shuningdek, RGB formatidagi ranglarni ajratib ko'rsatish mumkin. Qachonki, bu pulni yutib yuboradigan mashina, shuningdek, kassirlar uchun mo'ljallangan. Maqolani yaratish uchun siz o'zingiz yaratishingiz mumkin.

1 -qadam: Como Funciona?

2 -qadam: Circuito Armado Y Sus Materiales

O'chirish materiallari Armado Y Sus
O'chirish materiallari Armado Y Sus

Bu eng muhim materiallardan biri bo'lib, u Rocola funktsiyasini bajaradi!

- Arduino UNO

- Pantalla LCD 16x2 + Interfaz I2C

- Protoboard + Mini Protoboard

- Led RGB

- Passiv buzzer

- Protoboard taxtasida sakrash

- 2 Pulsadores Electricos

- O'chirish davri uchun

3 -qadam: O'chirish elektron sxemasi

Diagramma Esquemático Del Circuito Electrónico
Diagramma Esquemático Del Circuito Electrónico

4 -qadam: La Construcción de La Lámpara texnikasi

Bir vaqtning o'zida Rocola hech qanday farq qilmaydi. Siz Rocola funcione -ni tanlashingiz mumkin bo'lgan vaqtdan buyon jasorat qila olasiz.

- "2 -qadam" uchun zarur bo'lgan materialni tanlang.

- Bu "Arduino UNO" va "dasturiy ta'minot" funktsiyalari bilan bir vaqtda amalga oshirilishi kerak.

- "2 -qadam" bo'limining elektron sxemasi.

- O'qish dasturini nusxa ko'chirish va o'rnatish.

- O'ylaymanki, siz hech kim bilan shartnoma tuzolmaysiz, lekin bu sizning talabingizga javob bermaydi.

5 -qadam: Codigo De La Rokola

// Bosh sahifa: Xorxe Aragon

// I2C interfeysli LCD -kutubxona kutubxonalari #clude #include LiquidCrystal_I2C lcd (0x27, 16, 2); const int buzzer = 11; int contador = 0; int R = 6; int G = 9; int B = 10; int subir; int bajar; ////////////////////////////// MELODIAS //////////////////// ///////////define NOTE_B0 31 #devetine NOTE_C1 33 #devetine NOTE_CS1 35 #de NOTINE NOTE_D1 37 #deinine NOTE_DS1 39 #devetine NOTE_E1 41 #devetine NOTE_F1 44 #devetine NOTE_FS1 46 #de NOTEINEGG 49 49 52 #devetine NOTE_A1 55 #devetine NOTE_AS1 58 #deinine NOTE_B1 62 #de NOTINE NOTE_C2 65 #de NOTINE NOTE_CS2 69 #deinine NOTE_D2 73 #deFine NOTE_DS2 78 #deFINE NOTE_E2 82 #deFine NOTE_F2 87 #deFine NOTEFSE_G2 NOTE_A2 110 #ta'rifi NOTE_AS2 117 #foydalanish NOTE_B2 123 #ta'rifi NOTE_C3 131 #ta'rifi NOTE_CS3 139 #ta'rifi NOTE_D3 147 #notini belgilash NOTE_DS3 156 #foydalanish NOTE_E3 165 #ta'rifi NOTE_F3 175 #ta'rifi 220 #define NOTE_AS3 233 #devetine NOTE_B3 247 #devetine NOTE_C4 262 #de NOTINE NOTE_CS4 277 #deinine NOTE_D4 294 #de NOTINE NOTE_DS4 311 #de NOTINE NOTE_E4 330 #deFine NOTE_F4 349 #Define NOTEFEFF444G44 A4 440 #define NOTE_AS4 466 #devetine NOTE_B4 494 #devetine NOTE_C5 523 #devetine NOTE_CS5 554 #deinine NOTE_D5 587 #deinine NOTE_DS5 622 #deinine NOTE_E5 659 #deinine NOTE_F5 698 #define85E5588da #define NOTE_AS5 932 #devetine NOTE_B5 988 #devetine NOTE_C6 1047 #de NOTEINE NOTE_CS6 1109 #de NOTINE NOTE_D6 1175 #deFINE NOTE_DS6 1245 #de NOTEFE NOTE_E6 1319 #deFine NOTE_F6 1397 #DEFINE NOTEFEEFSE6666680 NOTE_AS6 1865 #define NOTE_B6 1976 #devetine NOTE_C7 2093 #devetine NOTE_CS7 2217 #devetine NOTE_D7 2349 #deinine NOTE_DS7 2489 #devetine NOTE_E7 2637 #deinine NOTE_F7 2794 #dein NOTE_FS7 NOT7ine #foydalaning NOTE_B7 3951 #ta'rifi NOTE_C8 4186 #belgilang NOTE_CS8 4435 #belgilang NOTE_D8 4699 #belgilang NOTE_DS8 4978 #RESTni belgilang 0 //////////////////////// Waker mavzusi ///////////////////////////// WindWaker_melody1 = {NOTE_A5, 4, NOTE_A5, 8, NOTE_A5, 4, NOTE_D6, 8, NOTE_F6, 4, NOTE_E6, 8, NOTE_D6, 4, NOTE_C6, 8, NOTE_D6, 4, NOTE_B5, 8, NOTE_G5, 4, NOTE_C6, 8, NOTE_A5, 8, NOTE_D6, 8, NOTE_B5, 8, NOTE_C6, 4, NOTE_A5, 8, NOTE_G5, 4, NOTE_D6, 8, NOTE_B5, 4, NOTE_C6, 8, NOTE_D6, 4, NOTE_E6, 8, NOTE_F6, 8, NOTE_D6, 8, NOTE_E6, 8, NOTE_A5, 4, NOTE_A5, 8, NOTE_A5, 4, NOTE_D6, 8, NOTE_F6, 4, NOTE_E6, 8, NOTE_D6, 4, NOTE_C6, 8, NOTE_D6, 4, NOTE_B5, 8, NOTE_G5, 4, NOTE_C6, 8, NOTE_A5, 8, NOTE_D6, 8, NOTE_B5, 8, NOTE_C6, 4, NOTE_D6, 8, NOTE_F6, 4, NOTE_A6, 8, NOTE_B6, 8, NOTE_F6, 8, NOTE_C6, 8, NOTE_D6, 2}; /////////////////////////// Bo'ronlar qo'shig'i ///////////////////// /////// const int SongOfStorms_melody2 PROGMEM = {NOTE_D5, 12, NOTE_F5, 12, NOTE_D6, 3, NOTE_D5, 12, NOTE_F5, 12, NOTE_D6, 3, NOTE_E6, 5, NOTE_F6, 10, NOTE_E6, 12, NOTE_F6, 12, NOTE_E6, 12, NOTE_C6, 12, NOTE_A5, 3, NOTE_A5, 6, NOTE_D5, 6, NOTE_F5, 12, NOTE_G5, 12, NOTE_A5, 2, NOTE_A5, 6, NOTE_D5, 6, NOTE_F5, 12, NOTE_G5, 12, NOTE_E5, 2, NOTE_D5, 12, NOTE_F5, 12, NOTE_D6, 3, NOTE_D5, 12, NOTE_F5, 12, NOTE_D6, 3, NOTE_E6, 5, NOTE_F6, 10, NOTE_E6, 12, NOTE_F6, 12, NOTE_E6, 12, NOTE_C6, 12, NOTE_A5, 3, NOTE_A5, 6, NOTE_D5, 6, NOTE_F5, 12, NOTE_G5, 12, NOTE_A5, 2, NOTE_A5, 6, NOTE_D5, 6, NOTE_F5, 12, NOTE_G5, 12, NOTE_E5, 2}; ///////////////////////// Minuet G Petzoldda ////////////////////// // int Minuet_melody3 = {NOTE_D5, 4, NOTE_G4, 8, NOTE_A4, 8, NOTE_B4, 8, NOTE_C5, 8, NOTE_D5, 4, NOTE_G4, 4, NOTE_G4, 4, NOTE_E5, 4, NOTE_C5, 8, NOTE_D5, 8, NOTE_E5, 8, NOTE_FS5, 8, NOTE_G5, 4, NOTE_G4, 4, NOTE_G4, 4, NOTE_C5, 4, NOTE_D5, 8, NOTE_C5, 8, NOTE_B4, 8, NOTE_A4, 8, NOTE_B4, 4, NOTE_C5, 8, NOTE_B4, 8, NOTE_A4, 8, NOTE_G4, 8, NOTE_FS4, 4, NOTE_G4, 8, NOTE_A4, 8, NOTE_B4, 8, NOTE_G4, 8, NOTE_A4, -2, NOTE_D5, 4, NOTE_G4, 8, NOTE_A4, 8, NOTE_B4, 8, NOTE_C5, 8, NOTE_D5, 4, NOTE_G4, 4, NOTE_G4, 4, NOTE_E5, 4, NOTE_C5, 8, NOTE_D5, 8, NOTE_E5, 8, NOTE_FS5, 8, NOTE_G5, 4, NOTE_G4, 4, NOTE_G4, 4, NOTE_C5, 4, NOTE_D5, 8, NOTE_C5, 8, NOTE_B4, 8, NOTE_A4, 8, NOTE_B4, 4, NOTE_C5, 8, NOTE_B4, 8, NOTE_A4, 8, NOTE_G4, 8, NOTE_A4, 4, NOTE_B4, 8, NOTE_A4, 8, NOTE_G4, 8, NOTE_FS4, 8, NOTE_G4, -2, NOTE_B5, 4, NOTE_G5, 8, NOTE_A5, 8, NOTE_B5, 8, NOTE_G5, 8, NOTE_A5, 4, NOTE_D5, 8, NOTE_E5, 8, NOTE_FS5, 8, NOTE_D5, 8, NOTE_G5, 4, NOTE_E5, 8, NOTE_FS5, 8, NOTE_G5, 8, NOTE_D5, 8, NOTE_CS5, 4, NOTE_B4, 8, NOTE_CS5, 8, NOTE_A4, 4, NOTE_A4, 8, NOTE_B4, 8, NOTE_CS5, 8, NOTE_D5, 8, NOTE_E5, 8, NOTE_FS5, 8, NOTE_G5, 4, NOTE_FS5, 4, NOTE_E5, 4, NOTE_FS5, 4, NOTE_A4, 4, NOTE_CS5, 4, NOTE_D5, -2, NOTE_D5, 4, NOTE_G4, 8, NOTE_FS5, 8, NOTE_G4, 4, NOTE_E5, 4, NOTE_G4, 8, NOTE_FS4, 8, NOTE_G4, 4, NOTE_D5, 4, NOTE_C5, 4, NOTE_B4, 4, NOTE_A4, 8, NOTE_G4, 8, NOTE_FS4, 8, NOTE_G4, 8, NOTE_A4, 4, NOTE_D4, 8, NOTE_E4, 8, NOTE_FS4, 8, NOTE_G4, 8, NOTE_A4, 8, NOTE_B4, 8, NOTE_C5, 4, NOTE_B4, 4, NOTE_A4, 4, NOTE_B4, 8, NOTE_D5, 8, NOTE_G4, 4, NOTE_FS4, 4, NOTE_G4, -2,}; // Tempo de las canciones int notes = sizeof (WindWaker_melody1)/sizeof (WindWaker_melody1 [0])/2; int notes2 = sizeof (SongOfStorms_melody2)/sizeof (SongOfStorms_melody2 [0])/2; int notes3 = sizeof (Minuet_melody3) / sizeof (Minuet_melody3 [0]) / 2; int tempi = 120; int temp 2 = 160; int tempi3 = 140; int wholenote = (60000 * 4) / temp; int wholenote2 = (60000 * 4) / temp 2; int wholenote3 = (60000 * 4) / temp 3; int divider = 0, noteDuration = 0; // Informalizacion del boton, LCD displey, RGB bo'sh sozlamalari () {Wire.begin (); lcd.begin (16, 2); lcd.clear (); lcd.backlight (); pinMode (signal, OUTPUT); pinMod (4, INPUT_PULLUP); pinMod (7, INPUT_PULLUP); pinMode (R, OUTPUT); pinMode (G, OUTPUT); pinMode (B, OUTPUT); } void loop () {if (contador == 0) {// Shamol ishlab chiqaruvchisi analogWrite (R, 0) rangini aniqlang; analogWrite (G, 255); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("SHAMOL QILISH"); for (int thisNote = 0; thisNote 0) {noteDuration = (to'liq) / bo'luvchi; } if if (divider <0) {// punktli yozuvlar salbiy davomiylik bilan ifodalanadi !! noteDuration = (yaxlit) / abs (ajratuvchi); noteDuration *= 1.5; // nuqta yozuvlari} davomiyligini ikki baravarga oshiradi} ohang (buzzer, WindWaker_melody1 [thisNote], noteDuration*0.9); // Keyingi eslatmani ijro etishdan oldin, uning davomiyligini kuting. subir = digitalRead (4); bajarilgan = digitalRead (7); kechikish (noteDuration); noTone (ovozli signal); agar (subir == LOW) {contador = 1; } if (bajarilgan == LOW) {contador = 2; } if (contador! = 0) {break; }}} else if (contador == 1) {// Bo'ronlarning analogWrite qo'shig'ini belgilang (R, 255); analogWrite (G, 0); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("Bo'ronlar qo'shig'i"); for (int thisNote = 0; thisNote 0) {// oddiy eslatma, davom eting noteDuration = (wholenote2) / divider; } else if (bo'luvchi <0) {noteDuration = (wholenote2) / abs (bo'luvchi); noteDuration *= 1,5; // nuqta qo'yilgan yozuvlar davomiyligini ikki baravarga oshiradi} ohang (buzzer, pgm_read_word_near (SongOfStorms_melody2+thisNote), noteDuration * 0.9); subir = digitalRead (4); bajarilgan = digitalRead (7); kechikish (noteDuration); noTone (ovozli signal); agar (subir == LOW) {contador = 2; } if (bajarilgan == LOW) {contador = 0; } if (contador! = 1) {break; }}} else if (contador == 2) {// Rangni belgilang Minuet analogWrite (R, 255); analogWrite (G, 255); analogWrite (B, 0); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("MINUET IN G"); lcd.setCursor (0, 1); lcd.print ("PETZOLD"); uchun (int thisNote = 0; thisNote 0) {noteDuration = (wholenote3) / bo'luvchi; } else if (bo'luvchi <0) {noteDuration = (wholenote3) / abs (bo'luvchi); noteDuration *= 1.5; // nuqta yozuvlari} davomiyligini ikki baravarga oshiradi} ohang (buzzer, Minuet_melody3 [thisNote], noteDuration * 0.9); subir = digitalRead (4); bajarilgan = digitalRead (7); kechikish (noteDuration); noTone (ovozli signal); agar (subir == LOW) {contador = 0; } subir = digitalRead (4); bajarilgan = digitalRead (7); if (bajarilgan == LOW) {contador = 1; } if (contador! = 2) {break; }}}}

Tavsiya: