ya imprime Xop

Dependencies:   C12832 mbed-rtos mbed

Fork of practica2_gil by PROCESAMIENTO_DIGITAL

Files at this revision

API Documentation at this revision

Comitter:
LuisFernandoTuzo
Date:
Tue Nov 07 17:17:43 2017 +0000
Parent:
1:6f592335f935
Commit message:
asdfghjkl

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Nov 07 16:29:27 2017 +0000
+++ b/main.cpp	Tue Nov 07 17:17:43 2017 +0000
@@ -2,46 +2,47 @@
 #include "rtos.h"
 #include "C12832.h"
  
+Serial pc(USBTX, USBRX); // tx, rx
 C12832 lcd(p5, p7, p6, p8, p11);
-Timer t;
-float Xop[4];
-float Hop[4];
-int h, f=-3;
+float Xop[5];
+float Hop[5];
+int f=0, h=0, i=0, j=-3;
 float a=0, b, c=0, d=0, e=0, w=0, g=0, r=0, s=0, z=0, u=0, v=0, x=0, y=0;
 Thread Muestreo, senal;
 AnalogOut Aout(p18);
 
-void seno() {}
+void seno() {
+    for (i = 0; i<5; i++){
+    b=3*sin(2000*3.1416*i*0.000125);
+    Aout = b;
+    Xop[i]= b; 
+    //lcd.printf("El valor es %.2f", Xop[1]);
+    }
     
-
+    for (j = -3; j<2; j++){
+    h = 2*j;
+    Hop[f] = h;
+    //lcd.printf("El valor es %.2f", Hop[f]);
+    f = f+1;
+    }
+}
 
 int main () {
     lcd.cls();
     lcd.locate(0,3);
     senal.start(seno);
-    
-    for (int i = 0; i<5; i++){
-    b=3*sin(2000*3.1416*i*0.000125);
-    Aout = b;
-    Xop[i]= b; 
-    Thread::wait(.125);
-    //lcd.printf("El valor es %.2f", Xop[1]);
-    }
-    
-    for (int j = 3; j>-1; j--){
-    h= 2*j;
-    Hop[f]=h;
-    //lcd.printf("El valor es %.2f", Hop[f]);
-    f=f+1;
-    }
-    
+       
     Thread::wait(3000);  
 
     //for (int k = 1; k<3; k++) {
-    lcd.printf("El valor es %.1f", Xop[0]);
+    /*lcd.printf("El valor es %.1f", Xop[0]);
     lcd.printf("El valor es %.1f", Xop[1]);
     lcd.printf("El valor es %.1f", Xop[2]);
-    lcd.printf("El valor es %.1f", Xop[3]);
+    lcd.printf("El valor es %.1f", Xop[3]);*/
+    pc.printf("El valor es %f \n", Xop[0]);
+    pc.printf("El valor es %f \n", Xop[1]);
+    pc.printf("El valor es %f \n", Xop[2]);
+    pc.printf("El valor es %f \n", Xop[3]);
     
     /*d = d + c;
     }
@@ -70,12 +71,12 @@
             //lcd.printf("El valor es %.1f", x);
             y=y+x;
         }*/
-        while (1) {
+        
         //lcd.printf("El valor es %.f", d);
         /*lcd.printf("El valor es %.1f", w);
         lcd.printf("El valor es %.1f", r);
         lcd.printf("El valor es %.1f", z);
         lcd.printf("El valor es %.1f", v);
         lcd.printf("El valor es %.1f", y);*/
-    }
+    
 }
\ No newline at end of file