BANDA SONORA STAR WARS
Programa Arduino:
/* Programa que reproduce la melodia de "Star Wars */
#define c3 7634
#define d3 6803
#define e3 6061
#define f3 5714
#define g3 5102
#define a3 4545
#define b3 4049
#define c4 3816 // 261 Hz
#define d4 3401 // 294 Hz
#define e4 3030 // 329 Hz
#define f4 2865 // 349 Hz
#define g4 2551 // 392 Hz
#define a4 2272 // 440 Hz
#define a4s 2146
#define b4 2028 // 493 Hz
#define c5 1912 // 523 Hz
#define d5 1706
#define d5s 1608
#define e5 1517 // 659 Hz
#define f5 1433 // 698 Hz
#define g5 1276
#define a5 1136
#define a5s 1073
#define b5 1012
#define c6 955
#define R 0 // Define a special note, ‘R’, to represent a rest
// Melody 1: Star Wars Imperial March
int melody1[] = { a4, R, a4, R, a4, R, f4, R, c5, R, a4, R, f4, R, c5, R, a4, R, e5, R, e5, R, e5, R, f5, R, c5, R, g5, R, f5, R, c5, R, a4, R};
int beats1[] = { 50, 20, 50, 20, 50, 20, 40, 5, 20, 5, 60, 10, 40, 5, 20, 5, 60, 80, 50, 20, 50, 20, 50, 20, 40, 5, 20, 5, 60, 10, 40, 5, 20, 5, 60, 40};
// Melody 2: Star Wars Theme
int melody2[] = { f4, f4, f4, a4s, f5, d5s, d5, c5, a5s, f5, d5s, d5, c5, a5s, f5, d5s, d5, d5s, c5};
int beats2[] = { 21, 21, 21, 128, 128, 21, 21, 21, 128, 64, 21, 21, 21, 128, 64, 21, 21, 21, 128 };
int MAX_COUNT = sizeof(melody1) / 2;
long tempo = 10000;
int pause = 1000;
int rest_count = 50;
int toneM = 0;
int beat = 0;
long duration = 0;
int potVal = 0;
int speakerOut = 9;
int led = 6;
void setup() {
pinMode(speakerOut, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
// Melody1
for (int i=0; i<MAX_COUNT; i++) {
toneM = melody1[i];
beat = beats1[i];
duration = beat * tempo;
playTone();
delayMicroseconds(pause);
}
// Melody2
MAX_COUNT = sizeof(melody2) / 2;
for (int i = 0; i < MAX_COUNT; i++) {
toneM = melody2[i];
beat = beats2[i];
duration = beat * tempo;
playTone();
delayMicroseconds(pause);
}
}
void playTone() {
long elapsed_time = 0;
if (toneM > 0) {
digitalWrite(led,HIGH);
while (elapsed_time < duration) {
digitalWrite(speakerOut,HIGH);
delayMicroseconds(toneM / 2);
digitalWrite(speakerOut, LOW);
delayMicroseconds(toneM / 2);
elapsed_time += (toneM);
}
digitalWrite(led,LOW);
}
else {
for (int j = 0; j < rest_count; j++) {
delayMicroseconds(duration);
}
}
}
BANDA SONORA PIRATAS DEL CARIBE
Programa Arduino:
/* Programa que reproduce la melodia de "Piratas del Caribe */
void setup() {
pinMode (9, OUTPUT); //pin configurado como salida
}
// funcion = tone(pin, frequency, duration)
void loop() {
tone(9, 293.66, 200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200); delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 200);
delay(200);
tone(9, 293.66, 100);
delay(100);
tone(9, 293.66, 100);
delay(100);
tone(9, 440, 100);
delay(100);
tone(9, 523.25, 100);
delay(100);
tone(9, 587.33, 100);
delay(200);
tone(9, 587.33, 100);
delay(200);
tone(9, 587.33, 100);
delay(100);
tone(9, 659.25, 100);
delay(100);
tone(9, 698.45, 100);
delay(200);
tone(9, 698.45, 100);
delay(200);
tone(9, 698.45, 100);
delay(100);
tone(9, 783.99, 100);
delay(100);
tone(9, 659.25, 100);
delay(200);
tone(9, 659.25, 100);
delay(200);
tone(9, 587.33, 100);
delay(100);
tone(9, 523.25, 100);
delay(100);
tone(9, 523.25, 100);
delay(100);
tone(9, 587.33, 100);
delay(300);
tone(9, 440, 100);
delay(100);
tone(9, 523.25, 100);
delay(100);
tone(9, 587.33, 100);
delay(200);
tone(9, 587.33, 100);
delay(200);
tone(9, 587.33, 100);
delay(100);
tone(9, 659.25, 100);
delay(100);
tone(9, 698.45, 100);
delay(200);
tone(9, 698.45, 100);
delay(200);
tone(9, 698.45, 100);
delay(100);
tone(9, 783.99, 100);
delay(100);
tone(9, 659.25, 100);
delay(200);
tone(9, 659.25, 100);
delay(200);
tone(9, 587.33, 100);
delay(100);
tone(9, 523.25, 100);
delay(100);
tone(9, 587.33, 100);
delay(400);
tone(9, 440, 100);
delay(100);
tone(9, 523.25, 100);
delay(100);
tone(9, 587.33, 100);
delay(200);
tone(9, 587.33, 100);
delay(200);
tone(9, 587.33, 100);
delay(100);
tone(9, 698.45, 100);
delay(100);
tone(9, 783.99, 100);
delay(200);
tone(9, 783.99, 100);
delay(200);
tone(9, 783.99, 100);
delay(100);
tone(9, 880, 100);
delay(100);
tone(9, 932.33, 100);
delay(200);
tone(9, 932.33, 100);
delay(200);
tone(9, 880, 100);
delay(100);
tone(9, 783.99, 100);
delay(100);
tone(9, 880, 100);
delay(100);
tone(9, 587.33, 100);
delay(300);
tone(9, 587.33, 100);
delay(100);
tone(9, 659.25, 100);
delay(100);
tone(9, 698.45, 100);
delay(200);
tone(9, 698.45, 100);
delay(200);
tone(9, 783.99, 100);
delay(200);
tone(9, 880, 100);
delay(100);
tone(9, 587.33, 100);
delay(300);
tone(9, 587.33, 100);
delay(100);
tone(9, 698.45, 100);
delay(100);
tone(9, 659.25, 100);
delay(200);
tone(9, 659.25, 100);
delay(200);
tone(9, 698.45, 100);
delay(100);
tone(9, 587.33, 100);
delay(100);
tone(9, 659.25, 100);
delay(400);
tone(9, 880, 100);
delay(100);
tone(9, 1046.50, 100);
delay(100);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1318.51, 100);
delay(100);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1567.98, 100);
delay(100);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1046.50, 100);
delay(100);
tone(9, 1046.50, 100);
delay(100);
tone(9, 1174.66, 100);
delay(300);
tone(9, 880, 100);
delay(100);
tone(9, 1046.50, 100);
delay(100);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1318.51, 100);
delay(100);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1567.98, 100);
delay(100);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1046.50, 100);
delay(100);
tone(9, 1174.66, 100);
delay(400);
tone(9, 880, 100);
delay(100);
tone(9, 1046.50, 100);
delay(100);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1567.98, 100);
delay(200);
tone(9, 1567.98, 100);
delay(200);
tone(9, 1567.98, 100);
delay(100);
tone(9, 1760, 100);
delay(100);
tone(9, 1864.66, 100);
delay(200);
tone(9, 1864.66, 100);
delay(200);
tone(9, 1760, 100);
delay(100);
tone(9, 1567.98, 100);
delay(100);
tone(9, 1760, 100);
delay(100);
tone(9, 1174.66, 100);
delay(300);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1318.51, 100);
delay(100);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1567.98, 100);
delay(200);
tone(9, 1760, 100);
delay(100);
tone(9, 1174.66, 100);
delay(300);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1174.66, 100);
delay(100);
tone(9, 1108.73, 100);
delay(100);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1174.66, 100);
delay(200);
tone(9, 1318.51, 100);
delay(200);
tone(9, 1396.91, 100);
delay(200);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1567.98, 100);
delay(200);
tone(9, 1760, 300);
delay(400);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1174.66, 100);
delay(100);
tone(9, 880, 300);
delay(600);
tone(9, 1864.66, 300);
delay(400);
tone(9, 1396.91, 100);
delay(100);
tone(9, 1174.66, 100);
delay(100);
tone(9, 932.33, 300);
delay(600);
tone(9, 587.33, 100);
delay(100);
tone(9, 440, 100);
delay(200);
tone(9, 587.33, 100);
delay(300);
tone(9, 554.36, 100);
delay(400);
tone(9, 1567.98, 100);
delay(100);
tone(9, 1567.98, 100);
delay(100);
}
QUEVEDO: BZRP MUSIC SESSION VOL.52/66
Programa Arduino:
#include <LiquidCrystal.h>
//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
const int pin_d4 = 4;
const int pin_d5 = 5;
const int pin_d6 = 6;
const int pin_d7 = 7;
const int pin_BL = 10;
LiquidCrystal lcd( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7);
const int RELAY_PIN = 2; // the Arduino pin, which connects to the IN pin of relay
int pinBuzzer = 12;
int Estado = LOW;
int C_ = 261/2;
int Cs_= 277/2;
int D_ = 293/2 ;
int Ds_= 311/2;
int E_ = 329/2 ;
int F_ = 349/2 ;
int Fs_= 369/2;
int G_ = 391/2 ;
int Gs_= 415/2;
int A_ = 440/2 ;
int As_= 466/2;
int B_ = 493/2 ;
int C = 261;
int Cs= 277;
int D = 293 ;
int Ds= 311;
int E = 329 ;
int F = 349 ;
int Fs= 369;
int G = 391 ;
int Gs= 415;
int A = 440 ;
int As= 466;
int B = 493 ;
int C2 =524;
int Cs2 =555;
int D2 =588;
int Ds2 =623;
int E2 =660;
int F2 =699;
int Fs2 =740;
int G2 =784;
int Gs2 =831;
int A_2 = 880;
int As2 =933;
int B2 =988;
int C3 =524*2;
int Cs3 =555*2;
int D3 =588*2;
int Ds3 =623*2;
int E3 =660*2;
int F3 =699*2;
int Fs3 =740*2;
int G3 =784*2;
int Gs3 =831*2;
int A_3 =880*2;
int As3 =933*2;
int B3 =988*2;
int C4 =524*4;
int Cs4 =555*4;
int D4 =588*4;
int Ds4 =623*4;
int E4 =660*4;
int F4 =699*4;
int Fs4 =740*4;
int G4 =784*4;
int Gs4 =831*4;
int A_4 =880*4;
int As4 =933*4;
int B4 =988*4;
int tempo = 128;
int semi = 60000/( tempo * 4 *2);
int corch = 2*semi;
int negra = corch*2;
int np = corch*3;
int blanca = negra*2;
int redonda = blanca*2;
int rep = 3*negra;
int bnp = 3*negra+3*corch;
int b =blanca;
int r =2*b;
int n = negra;
int c = corch;
int s = semi;
int f = s/2;
int sf = f/2;
int cp = c+s;
int Sil = 10;
int retardo = 115;
void nota(int nota, int duracion){
tone(pinBuzzer,nota, duracion);
delay(duracion);
noTone(pinBuzzer);
delay(duracion);
}
void notaP(int nota, int duracion){
tone(pinBuzzer,nota, duracion);
delay(2*duracion);
noTone(pinBuzzer);
}
void setup() {
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("Bizarrap+Quevedo");
lcd.setCursor(0,1);
lcd.print("Session 52 ");
delay(1000);
pinMode(RELAY_PIN, Estado);
}
void loop() {
YNosFuimoEnUna();
Quedate1();
TengoEnLaMente();
Quedate2();
delay(2500);
}
void nota_sf6(int N ,int d ){
int ttt = sf/2;
nota( N*0.70710678118 , ttt);
nota( N*0.74915353843 , ttt);
nota( N*0.79370052598 , ttt);
nota( N*0.84089641525 , ttt);
nota( N*0.89089871814 , ttt);
nota( N*0.94387431268 , ttt);
nota( N , d - 6*ttt);
}
void nota_sf(int N ,int d ){
int ttt = sf/2;
nota( N*0.84089641525 , ttt);
nota( N*0.89089871814 , ttt);
nota( N*0.94387431268 , ttt);
nota( N , d - 3*ttt);
}
void textopan(String S1,String S2){
lcd.setCursor(0,0);
lcd.print(S1);
lcd.setCursor(0,1);
lcd.print(S2);
}
void textoAbajo(String S2){
lcd.setCursor(0,1);
lcd.print(S2);
}
void YNosFuimoEnUna(){
textopan("Y nos fuimos en ","una ");
nota(B,c);
nota(B,c);
nota(B,c);
nota(B,c);
nota(A,c);
nota(B,n);
suenaRele();
nota(G,c);
textopan("Empezamos a la ","una ");
nota(G,c);
nota(G,c);
nota(G,c);
suenaRele();
nota(D2,c);
nota(Cs2,n);
nota(Fs ,c);
suenaRele();
nota(Sil,c);
textopan("Y con la nota ","rapido ");
nota(D2,c);
nota(D2,c);
nota(D2,c);
suenaRele();
nota(D2,c);
nota(Cs2,c);
nota(D2,c);
nota(A,c);
suenaRele();
nota(A,c);
textopan("nos dieron las ","tres ");
nota(A,c);
nota(A,c);
nota(A,c);
suenaRele();
nota(D2,c);
nota(Cs2,n);
///nota(Sil,c);
nota(Sil,s);
suenaRele();
nota(Sil,s);
suenaRele();
textopan("Perreamos toda ","la noche ");
suenaRele();
nota(E2,c);
nota(E2,c);
nota(E2,c);
nota(E2,c);
suenaRele();
nota(E2,c);
nota(D2,c);
suenaRele();
nota(G2,c);
nota(Fs2,c);
textopan("Y nos dormimos ","a las diez ");
suenaRele();
nota(E2,c);
nota(D2,c);
suenaRele();
nota(G2,c);
nota(Fs2,c);
suenaRele();
nota(E2,c);
nota(D2,c);
suenaRele();
nota(Sil,c);
nota(Sil,c);
textopan("Ando rezandole ","a Dios ");
suenaRele();
nota(E2,c);
nota(E2,c);
suenaRele();
nota(E2,c);
nota(E2,c);
suenaRele();
nota(E2,c);
nota(D2,c);
suenaRele();
nota(G2,c);
textopan("pa' repetirlo ","otra vez ");
suenaRele();
nota(Fs2,c);
suenaRele();
nota( E2,c);
suenaRele();
nota( D2,c);
suenaRele();
nota( G2,c);
suenaRele();
nota(Fs2,c);
suenaRele();
nota( D2,c);
suenaRele();
nota( E2,n+c);
nota(Sil ,n);
nota(Sil ,b);
}
void Quedate1(){
textopan("Quedate "," ");
tone(pinBuzzer,G2, 3*n);
delay(n);
delay(n);suenaRele();
delay(n);
noTone(pinBuzzer);
delay(3*n);
suenaRele();
nota(Fs2,c);
nota(Fs2,c+n);
textopan("Que las noches ","sin ti duelen ");
suenaRele();
nota(Fs2,c);
nota(Fs2,c);
nota( G2,c);
nota(Fs2,c);
suenaRele();
nota(E2,c);
nota(D2,c);
tone(pinBuzzer,Fs2, 3*n);
delay(n);
delay(n);suenaRele();
delay(n);
noTone(pinBuzzer);
delay(3*n);
suenaRele();
nota(E2,c);
nota(E2,n+c);
}
void TengoEnLaMente(){
textopan("Tengo en la ","mente las poses ");
suenaRele();
nota(Cs2,c);
nota(Cs2,c);
nota(Cs2,c);
nota(Cs2,c);
suenaRele();
nota(Cs2,c);
nota( B ,c);
nota(E2,cp);
nota(D2,s);
suenaRele();
nota(Sil,c);
textopan("y todos los ","gemidos :O ");
nota(Cs2,c);
nota(E2,cp);
nota(D2,s);
suenaRele();
nota(Sil,c);
nota(Cs2,c);
nota(E2,cp);
nota(D2,s);
suenaRele();
nota(Sil,c);
textopan("que ya no ","quiero nada ");
nota(Fs2,c);
nota(Fs2,c);
nota(Fs2,c);
suenaRele();
nota(Fs2,c);
nota(Fs2,c);
nota( G2,cp);
nota(Fs2,s);
suenaRele();
nota(Sil,c);
textopan("que no sea ","contigo ");
nota(E2,c);
nota( G2,cp);
nota(Fs2,s);
suenaRele();
nota(Sil,c);
nota(E2,c);
nota( G2,cp);
nota(Fs2,s);
suenaRele();
nota(Sil,n);
nota(Sil, n);
suenaRele();
nota(Sil, n);
}
void Quedate2(){
textopan("Quedate "," ");
suenaRele();
tone(pinBuzzer,G2, 3*n);
delay(n);
delay(n);suenaRele();
delay(n);
noTone(pinBuzzer);
delay(n);
suenaRele();
delay(n);
delay(n);
suenaRele();
nota(Fs2,c);
nota(Fs2,c);
suenaRele();
nota(Sil,n);
textopan("Que las noches ","sin ti ");
suenaRele();
nota(Fs2,c);
nota(Fs2,c);
suenaRele();
nota( G2,c);
nota(Fs2,c);
suenaRele();
nota(E2,c);
nota(D2,c);
textopan("due-e-e-e-len "," ");
//nota(Fs2,n+b);
suenaRele();
nota(Fs2,s); nota(Sil,s); nota(Fs2,s); nota(Sil,s);
suenaRele();
nota(Fs2,s); nota(Sil,s); nota(Fs2,s); nota(Sil,s);
suenaRele();
nota(Fs2,s); nota(Sil,s); nota(Fs2,s); nota(Sil,s);
suenaRele();
nota(E2,c);
nota(E2,c);
suenaRele();
nota(Sil,n);
textopan("Tengo en la ","mente las poses ");
suenaRele();
nota(Cs2,c);
nota(Cs2,c);
suenaRele();
nota(Cs2,c);
nota(Cs2,c);
suenaRele();
nota(Cs2,c);
nota( B ,c);
suenaRele();
nota(E2,cp);
nota(D2,s);
suenaRele();
nota(Sil,c);
textopan("y todo lo que ","hicimos :) ");
nota(Cs2,c);
suenaRele();
nota(E2,cp);
nota(D2,s);
suenaRele();
nota(Sil,c);
nota(Cs2,c);
suenaRele();
nota(E2,cp);
nota(D2,s);
suenaRele();
nota(Sil,c);
textopan("que ya no ","quiero nada ");
nota(Fs2,c);
suenaRele();
nota(Fs2,c);
nota(Fs2,c);
suenaRele();
nota(Fs2,c);
nota(Fs2,c);
suenaRele();
nota( G2,cp);
nota(Fs2,s);
suenaRele();
nota(Sil,c);
textopan("que no sea ","contigo ");
nota(E2,c);
suenaRele();
nota( G2,cp);
nota(Fs2,s);
suenaRele();
nota(Sil,c);
nota(E2,c);
suenaRele();
nota( G2,cp);
nota(Fs2,s);
suenaRele();
nota(Sil,n);
textopan("by/por ","@aeroroco ");
suenaRele();
nota(Sil, n);
suenaRele();
nota(Sil, n);
textopan("codigo en la ","pagina de mi Bio");
suenaRele();
}
void suenaRele(){
if ( Estado == LOW ){
Estado = HIGH;
}
else {
Estado = LOW;
}
pinMode(RELAY_PIN, Estado);
}