INHOUDSOPGAWE:

Jukebox + Arduino: 5 stappe
Jukebox + Arduino: 5 stappe

Video: Jukebox + Arduino: 5 stappe

Video: Jukebox + Arduino: 5 stappe
Video: It Became Unliveable! ~ Abandoned Home Of The Spenser's In The USA 2024, November
Anonim
Jukebox + Arduino
Jukebox + Arduino

Este proyecto consistió en crear for a Rocola Digital a través de una programación de Arduino. Su función es muy simple y no es muy difícil de crear. Daar is 'n groot aantal funksies wat u kan gebruik om 'n enkele LCD -skerm te sien, maar dit kan ook 'n weergawe van 'n enkele kleur of 'n kleur van 'n geleide RGB word. Así mismo, a través de dos pulsadores puedes cambiar de canción (de izquierda a derecha o viceversa). Dit is ook 'n wonderlike manier om 'n enkele vorm van skepping en skepping te bewerkstellig.

Stap 1: ¿Como Funciona?

Stap 2: Circuito Armado Y Sus Materiales

Circuito Armado Y Sus Materiales
Circuito Armado Y Sus Materiales

¡Es necesario que tengas estos materiales para hacer que tu Rocola funcione!

- Arduino UNO

- Pantalla LCD 16x2 + Interfaz I2C

- Protoboard + Mini Protoboard

- gelei RGB

- Passiewe gonser

- Springers vir Protoboard

- 2 Pulsadores Eléctricos

- Caja para el Circuito

Stap 3: Diagrama Esquemático Del Circuito Electrónico

Diagram van Esquemático Del Circuito Electrónico
Diagram van Esquemático Del Circuito Electrónico

Stap 4: Técnicas Para La Construcción De La Lámpara

Ons bied 'n verskeidenheid van Rocola no es tan difícil como aparenta. Dit is 'n goeie idee om u te help om 'n funksie te ontvang.

- Es necesario que consigas cada materiaal que se muestra en "Stap 2"

- Dit is 'n noodsaaklike funksie vir 'n funksionele funksie.

- Skep 'n volledige stap vir stap 2.

- Dit is 'n goeie idee om 'n volledige program te voltooi.

- Vir ultimo, usa tu creatividad y consigue algo que tengas en tu casa para poder hacer la mejor Rocola de tu vida y no te olvides en decorarla a tu criterio.

Stap 5: Código De La Rocola

// Creado por: Jorge Aragón

// Bevat librerias para la pantalla LCD met interfaces I2C #include #include LiquidCrystal_I2C lcd (0x27, 16, 2); const int gonser = 11; int Contador = 0; int R = 6; int G = 9; int B = 10; int subir; int bajar; ///////////////////////////////////// MELODIAS ////////////////////// /////////// #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 69 #define NOTE_D2 73 #define NOTE_DS2 78 #define NOTE_E2 82 #define NOTE_F2 87 #define NOTE_FS2 93 #DEFINE NOTA_2 definieer NOTE_A2 110 #define NOTE_AS2 117 #define NOTE_B2 123 #define NOTE_C3 131 #definieer NOTE_CS3 139 #definieer NOTE_D3 147 #definieer NOTE_DS3 156 #definieer NOTE_E3 165 #definieer NOTE_F3 175 #definieer NOTE_FS3 185 #3_definieer NOTE_DE3 220 #definieer NOTE_AS3 233 #definieer NOTE_B3 247 #definieer NOTE_C4 262 #definieer NOTE_CS4 277 #definieer NOTE_D4 294 #definieer NOTE_DS4 311 #definieer NOTE_E4 330 #definieer NOTE_F4 349 #definieer NOTE_FS4 370 #definieer NOTE_DE4 A4 440 #definieer NOTE_AS4 466 #definieer NOTE_B4 494 #definieer NOTE_C5 523 #definieer NOTE_CS5 554 #definieer NOTA_D5 587 #definieer NOTE_DS5 622 #definieer NOTE_E5 659 #definieer NOTE_F5 698 #definieer NOTE_FS5 740 #define 8de5 #785 #785 #define NOTA_AS5 932 #definieer NOTE_B5 988 #definieer NOTE_C6 1047 #definieer NOTE_CS6 1109 #definieer NOTE_D6 1175 #definieer NOTE_DS6 1245 #definieer NOTE_E6 1319 #definieer NOTE_F6 1397 #definieer NOTE_FS6 1480 #NOTE6define #de6de #de6de #de6de #de6de #de6de #de6de #de6de #de6de #de6de #de6de #define #de6de #de6de #de6de #de6de #define #de6de #define #define #define #de6de #define #de6e NOTE_AS6 1865 #definieer NOTE_B6 1976 #definieer NOTE_C7 2093 #definieer NOTE_CS7 2217 #definieer NOTE_D7 2349 #definieer NOTE_DS7 2489 #definieer NOTE_E7 2637 #definieer NOTE_F7 2794 #definieer NOTE_FS7 2960 #definieer NOTE_G7 3136 #definieer NOTE_G7 3136 #definieer NOTE_G7 3136 #definieer NOTE_G7 3136 #define NOTE_B7 3951 #definieer NOTE_C8 4186 #define NOTE_CS8 4435 #definieer NOTE_D8 4699 #definieer NOTE_DS8 4978 #definieer REST 0 ///////////////////////////// Wind Waker Theme ////////////////////////////////// int 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}; ////////////////////////////// Song of Storms ///////////////////// /////// const int SongOfStorms_melody2 PROGMEEM = {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 in G Petzold ////////////////////// // 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 note2 = sizeof (SongOfStorms_melody2)/sizeof (SongOfStorms_melody2 [0])/2; int note3 = sizeof (Minuet_melody3) / sizeof (Minuet_melody3 [0]) / 2; int tempo = 120; int tempo2 = 160; int tempo3 = 140; int wholenote = (60000 * 4) / tempo; int wholenote2 = (60000 * 4) / tempo2; int wholenote3 = (60000 * 4) / tempo3; int divider = 0, noteDuration = 0; // Inisialisering van boton, LCD -skerm, en geleide RGB -leemte -opstelling () {Wire.begin (); lcd.begin (16, 2); lcd.clear (); lcd.backlight (); pinMode (zoemer, UITGANG); pinMode (4, INPUT_PULLUP); pinMode (7, INPUT_PULLUP); pinMode (R, UITGANG); pinMode (G, UITGANG); pinMode (B, UITGANG); } void loop () {if (contador == 0) {// Definir el color con el que se verá wind maker analogWrite (R, 0); analogWrite (G, 255); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("WIND MAKER"); for (int thisNote = 0; thisNote 0) {noteDuration = (wholenote) / divider; } anders as (verdeler <0) {// stippelnote voorgestel word met negatiewe tydsduur !! noteDuration = (whole note) / abs (divider); note Duration *= 1.5; // verhoog die tydsduur met die helfte vir stippelnotas} toon (zoemer, WindWaker_melody1 [thisNote], noteDuration*0,9); // Wag vir die speelduur voordat u die volgende noot speel. subir = digitalRead (4); bajar = digitalRead (7); vertraging (noteDuration); noTone (gonser); as (subir == LOW) {contador = 1; } as (bajar == LOW) {contador = 2; } if (contador! = 0) {break; }}} anders if (contador == 1) {// Definir el color con el que se verá song of storms analogWrite (R, 255); analogWrite (G, 0); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("LIED VAN STORMS"); vir (int thisNote = 0; thisNote 0) {// gewone nota, gaan net verder noteDuration = (wholenote2) / divider; } anders as (deler <0) {noteDuration = (wholenote2) / abs (divider); note Duration *= 1.5; // verhoog die tydsduur met die helfte vir stippelnotas} toon (zoemer, pgm_read_word_near (SongOfStorms_melody2+thisNote), noteDuration * 0,9); subir = digitalRead (4); bajar = digitalRead (7); vertraging (noteDuration); noTone (gonser); as (subir == LOW) {contador = 2; } as (bajar == LOW) {contador = 0; } if (contador! = 1) {break; }}} anders if (contador == 2) {// Definir el color con el que se verá 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"); for (int thisNote = 0; thisNote 0) {noteDuration = (wholenote3) / divider; } anders as (divider <0) {noteDuration = (wholenote3) / abs (divider); note Duration *= 1.5; // verhoog die tydsduur met die helfte vir stippelnotas} toon (zoemer, Minuet_melody3 [thisNote], noteDuration * 0,9); subir = digitalRead (4); bajar = digitalRead (7); vertraging (noteDuration); noTone (gonser); as (subir == LOW) {contador = 0; } subir = digitalRead (4); bajar = digitalRead (7); as (bajar == LOW) {contador = 1; } if (contador! = 2) {break; }}}}

Aanbeveel: