Mündəricat:

Jukebox + Arduino: 5 addım
Jukebox + Arduino: 5 addım

Video: Jukebox + Arduino: 5 addım

Video: Jukebox + Arduino: 5 addım
Video: Using a Raspberry Pi to upgrade a broken jukebox! 2024, Iyul
Anonim
Jukebox + Arduino
Jukebox + Arduino

Bu proqram Rocola Digital və Arduino proqramlarından birindən ibarətdir. Bu sadədir və heç bir problem yaratmır. La Rocola çox funksiyanı yerinə yetirirsə, RGB ilə əlaqəli rənglərin fərqləndirilməsini ən yaxşı şəkildə LCD ekran və televiziya ekranlarından istifadə edə bilərsiniz. Bilmək olmazsa, bu, həm də kəşfiyyat kameraları ilə əlaqədardır (həm də əksinə). Şəxsi həyatınızı yaradın və yaradın.

Addım 1: Como Funciona?

Addım 2: Circuito Armado Y Sus Materiales

Circuito Armado Y Sus Materials
Circuito Armado Y Sus Materials

Bu, ən çox ehtiyac duyulan materialdır!

- Arduino UNO

- Pantalla LCD 16x2 + Interfaz I2C

- Protoboard + Mini Protoboard

- Led RGB

- Passiv Buzzer

- Protoboard üçün tullananlar

- 2 Pulsadores Eléctricos

- Circuito üçün

Addım 3: Diaqram Esquemático Del Circuito Electrónico

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

Addım 4: La Construcción De La Lámpara Tecnicas

Bu proqramlar bir -birindən fərqli olaraq, Rocola ilə heç bir fərqi yoxdur. Bu proqramlar, Rocola funcion proqramları üçün də cəsarət edə bilər.

- "2 -ci addım" üçün lazım olan materialların siyahısı

- Bu, "Arduino UNO" ilə əlaqəli deyil, həm də proqramın funksiyalarını yerinə yetirir.

- "Adım 2" ilə bağlı dövrə yaradın.

- Məşqlər və proqramlar ən çox istifadə edilən proqramdır.

- Əlbəttə ki, bir şərtlə ki, heç bir problem yoxdursa, heç bir problem yoxdur.

Addım 5: Código De La Rocola

// Creado müəllifi: Jorge Aragón

// I2C interfeysi üçün LCD kitabxanaları daxil edin #LiquidCrystal_I2C lcd daxil edin (0x27, 16, 2); const int buzzer = 11; int contador = 0; int R = 6; int G = 9; int B = 10; int subir; int icra; /////////////////////////////// MELODIAS //////////////////// ///////////define NOTE_B0 31 #define NOTE_C1 33 #deffine NOTE_CS1 35 #deinefine NOTE_D1 37 #deineDEQTE_DS1 39 #deffine NOTE_E1 41 #deffine NOTE_F1 44 #deffine NOTE_FS1 46 #deefine NOTE_G1 49 #define 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #deffine NOTE_C2 65 #deineFine NOTE_CS2 69 #define NOTE_D2 73 #deffine NOTE_DS2 78 #define NOTE_E2 82 #de NOTEFF 87 87 #define NOTEFFE_22 #define NOTE_A2 110 #təsnif NOTE_AS2 117 #define NOTE_B2 123 #Define NOTE_C3 131 #define NOTE_CS3 139 #define NOTE_D3 147 #define NOTE_DS3 156 #define NOTE_E3 165 #define NOTE_F3 175 #DefineDefineDefine 220 #define NOTE_AS3 233 #define NOTE_B3 247 #define NOTE_C4 262 #deffine NOTE_CS4 277 #deineFine NOTE_D4 294 #deffine NOTE_DS4 311 #deineFine NOTE_E4 330 #de NOTineFF 349 #Define NOTEFFE_4444 A4 440 #define NOTE_AS4 466 #define NOTE_B4 494 #deineNEWE_C5 523 #define NOTE_CS5 554 #define NOTE_D5 587 #deffine NOTE_DS5 622 #define NOTE_E5 659 #define NOTE_F5 698 #define85 #define NOTE_AS5 932 #define NOTE_B5 988 #define NOTE_C6 1047 #deffine NOTE_CS6 1109 #deinefine NOTE_D6 1175 #deffine NOTE_DS6 1245 #define NOTE_E6 1319 #define NOTE_F6 1397 #define NOTEFine_6F6666 NOTE_AS6 1865 #define NOTE_B6 1976 #define NOTE_C7 2093 #define NOTE_CS7 2217 #deineN NOTE_D7 2349 #define NOTE_DS7 2489 #deffine NOTE_E7 2637 #define NOTE_F7 2794 #define NOTE_FS7 NOT7define #define NOTE_B7 3951 #deffine NOTE_C8 4186 #deffine NOTE_CS8 4435 #deffine NOTE_D8 4699 #deffine NOTE_DS8 4978 #REST təyin et // ///////////////////////////////////////////////////// Waker Mövzusu ///////////////////////////// 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}; /////////////////////////// Fırtınalar mahnısı ///////////////////// /////// 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}; ///////////////////////////////////////////////////// hissə hissə hissəsində. // 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 tempi2 = 160; int tempi3 = 140; int wholenote = (60000 * 4) / temp; int wholenote2 = (60000 * 4) / temp 2; int wholenote3 = (60000 * 4) / temp 3; int bölücü = 0, noteDuration = 0; // Informallaşdırma düymələri, LCD panellər, RGB boşluğunun qurulması () {Wire.begin (); lcd.begin (16, 2); lcd.clear (); lcd.lightlight (); pinMode (səs siqnalı, ÇIXIŞ); pinMode (4, INPUT_PULLUP); pinMode (7, INPUT_PULLUP); pinMode (R, Çıxış); pinMode (G, Çıxış); pinMode (B, Çıxış); } void loop () {if (contador == 0) {// Külək istehsalçısı analogWrite (R, 0) rəngini təyin edin; analogWrite (G, 255); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("KÜLƏS MAKERİ"); for (int thisNote = 0; thisNote 0) {noteDuration = (wholenote) / bölücü; } başqa halda (bölücü <0) {// nöqtəli qeydlər mənfi müddətlərlə təmsil olunur !! noteDuration = (bütövlükdə) / abs (bölücü); noteDuration *= 1.5; // nöqtəli qeydlər üçün müddəti yarı artırır} ton (buzzer, WindWaker_melody1 [thisNote], noteDuration*0.9); // Növbəti notu səsləndirməzdən əvvəl xüsusi müddəti gözləyin. subir = digitalRead (4); tamamlandı = digitalRead (7); gecikmə (qeyd müddəti); noTone (səs siqnalı); if (subir == LOW) {contador = 1; } if (icra == LOW) {contador = 2; } if (contador! = 0) {break; }}} else if (contador == 1) {// Fırtınaların analogWrite mahnısının rəngini təyin edin (R, 255); analogWrite (G, 0); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("Fırtına mahnı"); for (int thisNote = 0; thisNote 0) {// müntəzəm qeyd, sadəcə noteDuration = (wholenote2) / bölücü ilə davam edin; } başqa halda (bölücü <0) {noteDuration = (wholenote2) / abs (bölücü); noteDuration *= 1.5; // nöqtəli qeydlər üçün müddəti yarıya qədər artırır} ton (buzzer, pgm_read_word_near (SongOfStorms_melody2+thisNote), noteDuration * 0.9); subir = digitalRead (4); tamamlandı = digitalRead (7); gecikmə (qeyd müddəti); noTone (səs siqnalı); if (subir == LOW) {contador = 2; } if (icra == LOW) {contador = 0; } if (contador! = 1) {break; }}} else if (contador == 2) {// Minuet analogWrite rəngini təyin edin (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"); for (int thisNote = 0; thisNote 0) {noteDuration = (wholenote3) / bölücü; } başqa halda (bölücü <0) {noteDuration = (wholenote3) / abs (bölücü); noteDuration *= 1.5; // nöqtəli qeydlər üçün müddəti yarı artırır} ton (buzzer, Minuet_melody3 [thisNote], noteDuration * 0.9); subir = digitalRead (4); tamamlandı = digitalRead (7); gecikmə (qeyd müddəti); noTone (səs siqnalı); if (subir == LOW) {contador = 0; } subir = digitalRead (4); tamamlandı = digitalRead (7); if (icra == LOW) {contador = 1; } if (contador! = 2) {break; }}}}

Tövsiyə: