chalala
Dependencies: FastAnalogIn NVIC_set_all_priorities mbed-dsp mbed
Fork of ProyFinal by
Diff: main.cpp
- Revision:
- 2:6f99f6b825b8
- Parent:
- 1:7655383ca5fd
diff -r 7655383ca5fd -r 6f99f6b825b8 main.cpp --- a/main.cpp Wed Dec 02 20:14:40 2015 +0000 +++ b/main.cpp Mon Nov 14 00:31:05 2016 +0000 @@ -6,8 +6,11 @@ #include "FastAnalogIn.h" #include <string> -//Enrique García Sandoval A01224184 -//Emmanuel Gonzalez Palacios A01228185 +//Luis Israel Rivera Rodriguez A01227916 +//Jesus Alfonso Lopez Chin A01228531 +//Jorge Alan Hernandez Torres A01228809 +//Jorge Daniel Nuñez +//David Olide // Basado en el código de Frank Vannieuwkerke en KL25Z_FFT_Demo // https://developer.mbed.org/users/frankvnk/code/KL25Z_FFT_Demo/ @@ -80,6 +83,7 @@ int col1 = frequencyToBin(1209); int col2 = frequencyToBin(1336); int col3 = frequencyToBin(1477); +int col4 = frequencyToBin(1633); int row1 = frequencyToBin(697); int row2 = frequencyToBin(770); int row3 = frequencyToBin(852); @@ -87,7 +91,7 @@ string valC1[] = {"1", "4", "7", "*"}; string valC2[] = {"2", "5", "8", "0"}; string valC3[] = {"3", "6", "9", "#"}; - +string valC4[] = {"A", "B", "C", "D"}; int maxCol(){ //Magnitud máxima en una columna int col = 0; @@ -101,8 +105,12 @@ col = 2; } if(magnitudes[col3] > max){ + max = magnitudes[col3]; col = 3; } + if(magnitudes[col4] > max){ + col = 4; + } return col; } @@ -142,6 +150,9 @@ case 3: salida = valC3[R]; break; + case 4: + salida = valC4[R]; + break; } return salida; } @@ -187,7 +198,9 @@ S = & arm_cfft_sR_f32_len4096; break; } - + int x=0; + string valor1; + string valor2; while(true){ // Calculate FFT if a full sample is available. if (samplingIsDone()) { @@ -197,10 +210,30 @@ arm_cmplx_mag_f32(samples, magnitudes, FFT_SIZE); // Restart audio sampling. samplingBegin(); - + if(x==0) + { + x=1; + valor1=(valor().c_str()); + printf("Valor1: "+valor1); + printf("\r\n"); + } + else + { + x=0; + valor2=(valor().c_str()); + printf("Valor 2: "+valor2); + printf("\r\n"); + } + if(valor2==valor1) + { + printf(valor().c_str()); + printf("\r\n"); + } + valor1=8; + valor2=6; //Correr identificacion de tonos - printf(valor().c_str()); - printf("\r\n"); + + }