Unidos pela Paes / Mbed 2 deprecated tarefa1

Dependencies:   mbed

Fork of tarefa1 by Pedro Mendes

Revision:
2:7476f7336e9a
Parent:
1:6e573b77c775
Child:
3:14310c47674c
--- a/Tarefa1.cpp	Thu Mar 12 11:23:50 2015 +0000
+++ b/Tarefa1.cpp	Thu Mar 12 11:29:04 2015 +0000
@@ -113,143 +113,3 @@
 // Apaga led quando termina
 // Coloque aqui o seu programa para tratamento dos dados.
 }
-
-
-
-//
-
-// Mede dois sinais
-
-#include <stdio.h>
-
-#include <stdlib.h>
-
-#include "math.h" // Descomente esta linha caso queira usar funções como sin(x)
-
-#define ESCALA_DE_TENSAO 3.3
-
-#define TAM_VALORES_MEDIA_AMPLITUDE 10
-
-int compare (const void* a, const void * b) {
-
-   const float *ia = (const float *) a;
-
-   const float *ib = (const float *) b;
-
-   
-
-   if (*ia < *ib) return 1;
-
-   if (*ia > *ib) return -1;
-
-   else return 0;
-
-}
-
-float calculaMedia(float *vetorValores, int tamVetorValores) {
-
-   float soma = 0;
-
-   for (int i = 0; i < tamVetorValores; i++) {
-
-       soma += vetorValores[i];
-
-   }
-
-   return (soma / tamVetorValores);
-
-}
-
-double calculaTensaoACSenoidal(float * vetorMedidas, int tamVetorMedidas) {
-
-   const int tamValores = TAM_VALORES_MEDIA_AMPLITUDE;
-
-   float valoresMaximos[tamValores];
-
-   float valoresMinimos[tamValores];
-
-   float mediaValoresMaximos, mediaValoresMinimos;
-
-   
-
-   qsort(vetorMedidas, tamVetorMedidas, sizeof(float), compare);
-
-   
-
-   for (int i = 0; i < tamValores; i++) {
-
-       valoresMaximos[i] = vetorMedidas[i];
-
-       valoresMinimos[i] = vetorMedidas[(tamVetorMedidas - 1) - i];
-
-   }
-
-   
-
-   mediaValoresMaximos = calculaMedia(valoresMaximos, tamValores);
-
-   mediaValoresMinimos = calculaMedia(valoresMinimos, tamValores);
-
-   
-
-   float amplitude = (mediaValoresMaximos - mediaValoresMinimos) * ESCALA_DE_TENSAO;
-
-   float tensaoEficaz = amplitude / 1.414;
-
-   
-
-   
-
-   // Para printar valores maximos e minimos
-
-   printf("Vetor de valores MAX: [");
-
-   for(int i = 0; i < tamValores; i++) {
-
-       printf(" %.2f,", valoresMaximos[i]);
-
-   }
-
-   printf("]\n");
-
-   
-
-   printf("Vetor de valores MIN: [");
-
-   for(int i = 0; i < tamValores; i++) {
-
-       printf("%.2f, ", valoresMinimos[i]);
-
-   }
-
-   printf("]\n");
-
-   
-
-   printf("Media valores MAX: %.2f\n", mediaValoresMaximos);
-
-   printf("Media valores MIN: %.2f\n", mediaValoresMinimos);
-
-   
-
-   printf("Amplitude calculada em volts: %.2f\n", amplitude);
-
-   printf("Tensao eficaz de %.2f volts\n", tensaoEficaz);
-
-   
-
-   return tensaoEficaz;
-
-}
-
-double calculaTensaoACIntegral(float *vetorMedidas, int tamVetorMedidas) {
-
-   
-
-   return 0;
-
-}
-
-
-
-  
\ No newline at end of file