// constants won't change const int RELAY_PIN = 13; // the Arduino pin, which connects to the IN pin of relay int pinBuzzer = 12; int C__ = 261/4; int Cs__= 277/4; int D__ = 293/4 ; int Ds__= 311/4; int E__ = 329/4 ; int F__ = 349/4 ; int Fs__= 369/4; int G__ = 391/4 ; int Gs__= 415/4; int A__ = 440/4 ; int As__= 466/4; int B__ = 493/4 ; 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 Sil = 5; 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 =1047; 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 =1047*2; 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 semi = 75; int fusa = semi/2; // int semi = 60; int corch = 2*semi; int sem3 = corch/3; 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 retardo = 100; int r = redonda; int b = blanca; int n = negra; int c = corch; int s = semi; int f = fusa; int bp = blanca+n; int np = negra+c; int cp = corch+s; void nota(int nota, int duracion){ tone(pinBuzzer,nota, duracion); delay(duracion); noTone(pinBuzzer); delay(duracion); } void setup() { // initialize digital pin as an output. pinMode(RELAY_PIN, OUTPUT); delay(500); } void loop() { ParaOlvidarme(); ParaMitristeza(); delay(1000); } //C D F G void ParaOlvidarme(){ // [1] nota(D,corch); // [2] nota(G,cp); nota(G,s); nota(A,c); nota(B,n); nota(A,c); // [3] nota(G,n); nota(G,c); nota(G,c); nota(Fs,c); nota(E,c); // [4] nota(G,np); nota(Fs,c); nota(E,n); // [5] nota(D,np); nota(Sil,c); nota(Sil,c); nota(D,c); // [6] nota(E,cp); nota(E,s); nota(Fs,c); nota(A,n); nota(Fs,c); // [7] nota(G,n); nota(D,c); nota(D,c); nota(C,c); nota(B_,c); // [8] nota(D,np); nota(D,c); nota(C,n); // [9] nota(B_,np); nota(Sil,c); nota(Sil,c); nota(D,c); // [10] nota(G,cp); nota(G,s); nota(A,c); nota(B,n); nota(A,c); // [11] nota(G,n); nota(G,c); nota(G,c); nota(Fs,c); nota(E,c); // [12] nota(G,np); nota(Fs,c); nota(E,n); // [13] nota(D,np); nota(Sil,c); nota(Sil,c); nota(D,c); nota(E,cp); nota(E,s); nota(Fs,c); nota(A,n); nota(Fs,c); } void ParaMitristeza(){ // [14] nota(G,n); nota(D,c); // [15] nota(D,c); nota(C,c); nota(B_,c); // [16] nota(D,np); nota(D,c); nota(C,n); //--------------------------------------- // [17] nota(B_,n); //nota(Sil,n); int num_notas= 7*2+4+0; int ttt = n/num_notas; nota(B4,ttt); nota(A_4,ttt); nota(G4,ttt); nota(Fs4,ttt); nota(E4,ttt); nota(D4,ttt); nota(C4,ttt); nota(B3,ttt); nota(A_3,ttt); nota(G3,ttt); nota(Fs3,ttt); nota(E3,ttt); nota(D3,ttt); nota(C3,ttt); nota(B2,ttt); nota(A_2,ttt); nota(G2,ttt); nota(Fs2,ttt); nota(Fs,s); nota(Fs,s); nota(Fs,s); nota(G,s); // [18] nota(A,cp); nota(A,s); nota(G,c); nota(Fs,n); nota(E,c); // [19] nota(D,np); nota(Sil,c); nota(A,s); nota(A,s); nota(A,s); nota(A,s); // [20] nota(A,cp); nota(A,s); nota(A,c); nota(B,n); nota(G,c); // [21] nota(A,np); nota(Sil,c); nota(A,s); nota(B,s); nota(A,s); nota(B,s); // [22] nota(C2,cp); nota(A,s); nota(A,c); nota(C2,c); nota(A ,c); nota(B,n); // ...23 nota(G,c); nota(A,c); nota(B,c); nota(B,c); nota(A,n); // ...[24] nota(Fs,cp); nota(Fs,s); nota(A,n); nota(Fs,c); // [25] nota(G,np); nota(Sil,c); nota(A,s); nota(B,s); nota(A,s); nota(B,s); // [22] nota(C2,cp); nota(A,s); nota(A,c); nota(C2,c); nota(A ,c); nota(B,n); // ...23 nota(G,c); nota(A,c); nota(B,c); nota(B,c); nota(A,n); // ...[24] nota(Fs,cp); nota(Fs,s); nota(A,n); nota(Fs,c); // [25] nota(G,np); nota(Sil,c); }