
proyecto Smart Meter
Diff: main.cpp
- Revision:
- 0:776a559bda2f
- Child:
- 1:fa4a5417c176
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 17 23:04:09 2018 +0000 @@ -0,0 +1,64 @@ +#include "mbed.h" +#include "math.h" +#include "TextLCD.h" + +#define muestras 100 + +TextLCD lcd(D8, D9, D2, D3, D4, D5, TextLCD::LCD16x2); // rs, e, d4-d7 +Serial pc(USBTX, USBRX); // tx, rx + +int contador=0; +int bufferActivo=0; +int flag=0; +AnalogIn tension(A0); +AnalogIn intensidad(A1); + + +struct Vectores{ + float vTensionA[muestras]; + float vTensionB[muestras]; + float vIntensidadA[muestras]; + float vIntensidadB[muestras]; +}vectores; + +struct Medidas{ + float Vrms; + float Irms; +}medidas; + +void visualizacion() +{ + float datoTension=tension.read(); +} + + + +int eBoton=0; + +void captura() +{ + + + if(bufferActivo) { + + } else { + + } + + if(contador==muestras) { + + } +} + +int main() +{ + Ticker timerCaptura; + Ticker timerVisualizacion; + timerCaptura.attach_us(&captura,200); + timerVisualizacion.attach(&visualizacion,1.0); + while(1) { + if(flag) { + + } + } +}