..

Dependencies:   mbed Adafruit_GFX

Files at this revision

API Documentation at this revision

Comitter:
anyela
Date:
Sun Jan 23 05:07:50 2022 +0000
Commit message:
,

Changed in this revision

Adafruit_GFX.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Adafruit_GFX.lib	Sun Jan 23 05:07:50 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/nkhorman/code/Adafruit_GFX/#7fb1d4d3525d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jan 23 05:07:50 2022 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+
+// Macros y constantes 
+#define N 100             // Número de muestras por ciclo sinusoidal
+#define Ts 0.01667/N //  periodo de muestreo 
+
+
+// Instancias 
+Ticker t; // interrupciòn periodica. evento que dispara la ejecución de una subrutina interrumpiendo la ejecucion normal. 
+DigitalOut myled(LED2);
+AnalogIn Vin(p15);
+
+
+
+// variables y arreglos 
+uint16_t  i=0,Varr[N]; // Arreglo para almacenar señales de voltaje y corriente 
+
+// Funciones
+void sample(){
+    if (i<N){
+    Varr[i]=Vin.read_u16();
+    i++;
+    }
+    
+}
+
+uint16_t find_PK(uint16_t* arr, uint16_t size){    // se pasa la posicion de memoria del arreglo y valor inmediato del tamaño vector
+    uint16_t peak = 0;
+    for(int i=0;i<size; i++){
+        if (arr[i]>peak)
+        peak = i;
+        }
+        return peak;
+}
+
+int main() {
+    t.attach(&sample,Ts);
+    pc.baud(115200);
+    
+    while(1) {
+        if(i==N){
+    
+         
+             }
+        i=0;               
+        }  
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jan 23 05:07:50 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file