Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- elenaramirezperez1
- Date:
- 2019-10-15
- Revision:
- 0:2b6bac81f08c
File content as of revision 0:2b6bac81f08c:
#include "mbed.h" #include "datos.h" #include "math.h" Timer timer; float resultado; int tiempo; float calcularRMS(int16_t *datos, int longitud); int main() { timer.reset(); timer.start(); resultado=calcularRMS(datos, 500); timer.stop(); printf("****El valor Vrms es %f calculado en %d us ****\n",resultado,timer.read_us()); } float calcularRMS(int16_t *datos, int longitud) { int64_t sumatorio=0; for (int i=0; i< longitud;i++) { sumatorio =+ datos[i]*datos[i]; } float cte = 0.0001007080078125; int resultado = cte * sqrt((float)sumatorio/longitud); return resultado; }