Sisukord:

Jukebox + Arduino: 5 sammu
Jukebox + Arduino: 5 sammu

Video: Jukebox + Arduino: 5 sammu

Video: Jukebox + Arduino: 5 sammu
Video: Неприятный сюрприз от Arduino(( 2024, Juuli
Anonim
Jukebox + Arduino
Jukebox + Arduino

Este proyecto konsistentsi ja luua Rocola Digital ja Arduino programmi programm. Su función es muy simple y no es muy difícil de crear. La Rocola tiene muchas funciones interesantes, y una de ellas es que a través de una a pantalla LCD se muestra el nombre de la canción que se esta reproduciendo, y que para cada canción se muestra and color distinto a través de un led led RGB. Así mismo, a través de dos pulsadores puedes cambiar de canción (de izquierda a derecha o viceversa). Aquí te mostraré paso a paso en como crear uno de una forma sencilla y creativa.

Samm: ¿Como Funciona?

2. etapp: Circuito Armado Y Sus Materiales

Circuito Armado ja Sus Materiales
Circuito Armado ja Sus Materiales

¡See on vajalik quo tengas estos materiales para hacer que tu Rocola funcione!

- Arduino UNO

- Pantalla LCD 16x2 + Interfaz I2C

- Protoboard + Mini Protoboard

- LED -RGB

- Passiivne helisignaal

- Protopoardi džemprid

- 2 Pulsadores Eléctricos

- Caja para el Circuito

3. samm: Diagrama Esquemático Del Circuito Electrónico

Elektrooniline ringraja esquemático del Circuito
Elektrooniline ringraja esquemático del Circuito

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

Como te comentaba, el crear una Rocola no es tan difícil como aparenta. Aquí te dare unas técnicas que te serán útiles para poder hacer que tu Rocola funcione.

- Es necesario que consigas cada material que se muestra et "Step 2"

- Essees ques tengas un "Arduino UNO", igual que la aplicación para poder hacer que la programción funcione.

- Crea el circuit físico el cual te muestro et "2. etapp".

- Loe edasi tener todo armado copia la programción el cual te mostraré en el ultimo paso.

- Por último, 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.

Samm: Código De La Rocola

// Creado por: Jorge Aragón

// Lisage librerias para la pantalla LCD con interfaz I2C #include #include LiquidCrystal_I2C lcd (0x27, 16, 2); const int helisignaal = 11; int kontador = 0; int R = 6; int G = 9; int B = 10; int subir; int bajar; //////////////////////////////////////////// MELODIAS ////////////////// /////////// #defineeri NOTE_B0 31 #defineeri NOTE_C1 33 #defineeri NOTE_CS1 35 #defineeri NOTE_D1 37 #defineeri NOTE_DS1 39 #defineeri NOTE_E1 41 #defineeri NOTE_F1 44 #defineeri NOTE_FS1 46 #defineeri NOTE_G1 49 #defineeri 52 #defineeri NOTE_A1 55 #defineeri NOTE_AS1 58 #defineeri NOTE_B1 62 #defineeri NOTE_C2 65 #defineeri NOTE_CS2 69 #defineeri NOTE_D2 73 #defineeri NOTE_DS2 78 #defineeri NOTE_E2 82 #defineeri NOTE_F2 87 #defineeri NOTE_FS2 93 #defineeri määratle NOTE_A2 110 #defineeri NOTE_AS2 117 #defineeri NOTE_B2 123 #defineeri NOTE_C3 131 #defineeri NOTE_CS3 139 #defineeri NOTE_D3 147 #defineeri NOTE_DS3 156 #defineeri NOTE_E3 165 #defineeri NOTE_F3 175 #defineeri NOTE_FS3 185E_deine 220 #defineeri NOTE_AS3 233 #defineeri NOTE_B3 247 #defineeri NOTE_C4 262 #defineeri NOTE_CS4 277 #defineeri NOTE_D4 294 #defineeri NOTE_DS4 311 #defineeri NOTE_E4 330 #defineeri NOTE_F4 349 #defineeri NOTE_FS4 370 #defineeri A4 440 #defineerimine NOTE_AS4 466 #defineerimine NOTE_B4 494 #defineerimine NOTE_C5 523 #defineerimine NOTE_CS5 554 #defineerimine NOTE_D5 587 #defineerimine NOTE_DS5 622 #defineerimine NOTE_E5 659 #defineerimine NOTE_F5 698 #defineerimine NOTE_FS5 780 #defineerimine #defineeri NOTE_AS5 932 #defineeri NOTE_B5 988 #defineeri NOTE_C6 1047 #defineeri NOTE_CS6 1109 #defineeri NOTE_D6 1175 #defineeri NOTE_DS6 1245 #defineeri NOTE_E6 1319 #defineeri NOTE_F6 1397 #defineeri NOTE_FS6 1480 #defineeri NOTE_AS6 1865 #defineeri NOTE_B6 1976 #defineeri NOTE_C7 2093 #defineeri NOTE_CS7 2217 #defineeri NOTE_D7 2349 #defineeri NOTE_DS7 2489 #defineeri NOTE_E7 2637 #defineeri NOTE_F7 2794 #define NOTE_FS7 2960 #define #definee #defineeri NOTE_B7 3951 #defineeri NOTE_C8 4186 #defineeri NOTE_CS8 4435 #defineeri NOTE_D8 4699 #defineeri NOTE_DS8 4978 #define REST 0 /////////////////////// Wakeri teema /////////////////////////// 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}; /////////////////////////// Tormide laul /////////////////// /////// 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 Petzoldis ///////////////////// // 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 märkmed2 = sizeof (SongOfStorms_melody2)/sizeof (SongOfStorms_melody2 [0])/2; int notes3 = 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 jagaja = 0, noteDuration = 0; // Inicializacion del boton, pantalla LCD, y led RGB void setup () {Wire.begin (); lcd.algus (16, 2); lcd.clear (); lcd.taustavalgus (); pinMode (helisignaal, VÄLJUND); pinMode (4, INPUT_PULLUP); pinMode (7, INPUT_PULLUP); pinMode (R, VÄLJUND); pinMode (G, VÄLJUND); pinMode (B, VÄLJUND); } void loop () {if (contador == 0) {// Määratlege värvitoonid tuulevalmistaja analogWrite (R, 0); analogWrite (G, 255); analogWrite (B, 255); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("TUULETEGIJA"); for (int thisNote = 0; thisNote 0) {noteDuration = (Wholenote) / jagaja; } else if (jagaja <0) {// punktiirmärkmed on esitatud negatiivsete kestustega !! noteDuration = (Wholenote) / abs (jagaja); märkusKestus *= 1,5; // pikendab punktiga nootide kestust poole võrra} toon (sumin, WindWaker_melody1 [seeMärkus], märgeKestus*0,9); // Enne järgmise noodi mängimist oodake ootamisaega. alamliik = digitalRead (4); bajar = digitalRead (7); viivitus (märgeKestus); noTone (helisignaal); kui (alam = = LOW) {contador = 1; } kui (bajar == LOW) {contador = 2; } if (contador! = 0) {break; }}} muidu kui (contador == 1) {// Määratlege värvide värvus 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 ("LUULETE LAUL"); for (int thisNote = 0; thisNote 0) {// tavaline märkus, jätkake lihtsalt noteDuration = (wholenote2) / divider; } else if (jagaja <0) {noteDuration = (wholenote2) / abs (jagaja); märkusKestus *= 1,5; // pikendab punktiga nootide kestust poole võrra} toon (helisignaal, pgm_read_word_near (SongOfStorms_melody2+thisMote), noteDuration * 0.9); alamliik = digitalRead (4); bajar = digitalRead (7); viivitus (märgeKestus); noTone (helisignaal); kui (alam = = LOW) {contador = 2; } kui (bajar == LOW) {contador = 0; } if (contador! = 1) {break; }}} muidu, kui (contador == 2) {// Määratlege värvide värvus minu eluks 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) / jagaja; } else if (jagaja <0) {noteDuration = (wholenote3) / abs (jagaja); märkusKestus *= 1,5; // pikendab punktiga nootide kestust poole võrra} toon (sumin, Minuet_melody3 [seeMärkus], märgeKestus * 0,9); alamliik = digitalRead (4); bajar = digitalRead (7); viivitus (märgeKestus); noTone (helisignaal); kui (alam = = LOW) {contador = 0; } alamliik = digitalRead (4); bajar = digitalRead (7); kui (bajar == LOW) {contador = 1; } if (contador! = 2) {break; }}}}

Soovitan: